Convert the network subfolder to py3/py2.4 syntax (#3690)

This commit is contained in:
Michael Scherer 2016-05-18 18:08:30 +02:00 committed by Matt Clay
commit c0217e14a7
20 changed files with 90 additions and 47 deletions

View file

@ -225,7 +225,8 @@ def url_get(module, url, dest, use_proxy, last_mod_time, force, timeout=10, head
f = os.fdopen(fd, 'wb')
try:
shutil.copyfileobj(rsp, f)
except Exception, err:
except Exception:
err = get_exception()
os.remove(tempname)
module.fail_json(msg="failed to create temporary content file: %s" % str(err))
f.close()
@ -391,7 +392,8 @@ def main():
if os.path.exists(dest):
backup_file = module.backup_local(dest)
shutil.copyfile(tmpsrc, dest)
except Exception, err:
except Exception:
err = get_exception()
os.remove(tmpsrc)
module.fail_json(msg="failed to copy %s to %s: %s" % (tmpsrc, dest, str(err)))
changed = True