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

Make retry file generation not use StringIO

This commit is contained in:
James Cammarata 2016-01-26 14:52:41 -05:00
parent 78d499140c
commit 3ed3a5f43a

View file

@ -19,7 +19,6 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
import StringIO
import getpass import getpass
import locale import locale
import os import os
@ -256,14 +255,10 @@ class PlaybookExecutor:
information in group_vars/host_vars but that is ok, and expected. information in group_vars/host_vars but that is ok, and expected.
''' '''
buf = StringIO.StringIO()
for x in replay_hosts:
buf.write("%s\n" % x)
try: try:
fd = open(retry_path, 'w') with open(retry_path, 'w') as fd:
fd.write(buf.getvalue()) for x in replay_hosts:
fd.close() fd.write("%s\n" % x)
except Exception as e: except Exception as e:
display.error("Could not create retry file '%s'. The error was: %s" % (retry_path, e)) display.error("Could not create retry file '%s'. The error was: %s" % (retry_path, e))
return False return False