mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Fix up modules that have python24 syntax error
This commit is contained in:
parent
a03da8d592
commit
8bd5757720
17 changed files with 104 additions and 58 deletions
|
@ -162,7 +162,7 @@ def main():
|
|||
module.exit_json(changed=True, **deployment)
|
||||
else:
|
||||
module.fail_json(msg=json.dumps(info))
|
||||
except Exception as e:
|
||||
except Exception, e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
# import module snippets
|
||||
|
|
|
@ -213,7 +213,7 @@ def download_request(module, name, apiid, apikey, cert_type):
|
|||
cert_file = open(cert_file_path, 'w')
|
||||
cert_file.write(body)
|
||||
cert_file.close
|
||||
os.chmod(cert_file_path, 0o600)
|
||||
os.chmod(cert_file_path, 0600)
|
||||
except:
|
||||
module.fail_json("Could not write to certificate file")
|
||||
|
||||
|
|
|
@ -138,11 +138,11 @@ def post_annotation(module):
|
|||
|
||||
headers = {}
|
||||
headers['Content-Type'] = 'application/json'
|
||||
headers['Authorization'] = b"Basic " + base64.b64encode(user + b":" + api_key).strip()
|
||||
headers['Authorization'] = "Basic " + base64.b64encode(user + ":" + api_key).strip()
|
||||
req = urllib2.Request(url, json_body, headers)
|
||||
try:
|
||||
response = urllib2.urlopen(req)
|
||||
except urllib2.HTTPError as e:
|
||||
except urllib2.HTTPError, e:
|
||||
module.fail_json(msg="Request Failed", reason=e.reason)
|
||||
response = response.read()
|
||||
module.exit_json(changed=True, annotation=response)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue