Switch open() for salt.utils.fopen()

This commit is contained in:
Pedro Algarvio 2014-11-26 18:42:59 +00:00
parent 33066c56fd
commit 24f9c8f8d9

View File

@ -181,7 +181,7 @@ def _exec_cmd(*args, **kwargs):
result = __salt__['cmd.run_all']('script -q -c "{0}" {1}'.format(cmd_exec, filename))
# Read the output from the script command, stripping the first line
with open(filename, 'r') as outfile:
with salt.utils.fopen(filename, 'r') as outfile:
stdout = outfile.readlines()
result['stdout'] = ''.join(stdout[1:])
os.remove(filename)