1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

When outputting text to a file, convert to bytes first.

Fixes #23137
This commit is contained in:
Toshio Kuratomi 2017-03-30 08:31:09 -07:00 committed by Brian Coca
parent 2e476e64cd
commit 0249918c7b

View file

@ -1,11 +1,12 @@
#!/usr/bin/env python #!/usr/bin/env python
import os import os
import io
import sys import sys
from jinja2 import Environment, FileSystemLoader from jinja2 import Environment, FileSystemLoader
from ansible.module_utils._text import to_bytes
def get_options(optlist): def get_options(optlist):
''' get actual options ''' ''' get actual options '''
@ -124,6 +125,6 @@ if __name__ == '__main__':
manpage = template.render(tvars) manpage = template.render(tvars)
filename = '../man/man1/%s' % output[libname] filename = '../man/man1/%s' % output[libname]
with io.open(filename, 'w') as f: with open(filename, 'wb') as f:
f.write(manpage) f.write(to_bytes(manpage))
print("Wrote man docs to %s" % filename) print("Wrote man docs to %s" % filename)