Fix some errors pointed out by travis

pull/18777/head
Monty Taylor 10 years ago committed by Matt Clay
parent 9e2c4efa53
commit 32c5c00cde

@ -82,10 +82,10 @@ def _write_structured_data(basedir, basename, data):
if not os.path.exists(basedir): if not os.path.exists(basedir):
os.makedirs(basedir) os.makedirs(basedir)
file_path = os.path.join(basedir, "{0}.json".format(basename)) file_path = os.path.join(basedir, "{0}.json".format(basename))
with os.fdopen( out_file = os.fdopen(
os.open(file_path, os.O_CREAT | os.O_WRONLY, 0o600), os.open(file_path, os.O_CREAT | os.O_WRONLY, 0o600), 'w')
'w') as out_file:
out_file.write(json.dumps(data).encode('utf8')) out_file.write(json.dumps(data).encode('utf8'))
out_file.close()
def main(): def main():
@ -116,7 +116,7 @@ def main():
if not os.path.exists(p['manifest']): if not os.path.exists(p['manifest']):
module.fail_json( module.fail_json(
msg="Manifest file %(manifest)s not found." % dict( msg="Manifest file %(manifest)s not found." % dict(
manifest=p['manifest']) manifest=p['manifest']))
# Check if puppet is disabled here # Check if puppet is disabled here
if p['puppetmaster']: if p['puppetmaster']:
@ -150,7 +150,7 @@ def main():
else: else:
cmd = ("%(base_cmd) apply --detailed-exitcodes %(manifest)s" % dict( cmd = ("%(base_cmd) apply --detailed-exitcodes %(manifest)s" % dict(
base_cmd=base_cmd, base_cmd=base_cmd,
manifest=pipes.quote(p['manifest'])) manifest=pipes.quote(p['manifest'])))
rc, stdout, stderr = module.run_command(cmd) rc, stdout, stderr = module.run_command(cmd)
if rc == 0: if rc == 0:

Loading…
Cancel
Save