mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-14 07:55:05 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -92,7 +92,6 @@ from ansible.module_utils.urls import fetch_url
|
|||
|
||||
|
||||
def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
token=dict(required=True, no_log=True),
|
||||
|
|
@ -101,43 +100,43 @@ def main():
|
|||
user=dict(),
|
||||
rollbar_user=dict(),
|
||||
comment=dict(),
|
||||
url=dict(default='https://api.rollbar.com/api/1/deploy/'),
|
||||
validate_certs=dict(default=True, type='bool'),
|
||||
url=dict(default="https://api.rollbar.com/api/1/deploy/"),
|
||||
validate_certs=dict(default=True, type="bool"),
|
||||
),
|
||||
supports_check_mode=True
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True)
|
||||
|
||||
params = dict(
|
||||
access_token=module.params['token'],
|
||||
environment=module.params['environment'],
|
||||
revision=module.params['revision']
|
||||
access_token=module.params["token"],
|
||||
environment=module.params["environment"],
|
||||
revision=module.params["revision"],
|
||||
)
|
||||
|
||||
if module.params['user']:
|
||||
params['local_username'] = module.params['user']
|
||||
if module.params["user"]:
|
||||
params["local_username"] = module.params["user"]
|
||||
|
||||
if module.params['rollbar_user']:
|
||||
params['rollbar_username'] = module.params['rollbar_user']
|
||||
if module.params["rollbar_user"]:
|
||||
params["rollbar_username"] = module.params["rollbar_user"]
|
||||
|
||||
if module.params['comment']:
|
||||
params['comment'] = module.params['comment']
|
||||
if module.params["comment"]:
|
||||
params["comment"] = module.params["comment"]
|
||||
|
||||
url = module.params.get('url')
|
||||
url = module.params.get("url")
|
||||
|
||||
try:
|
||||
data = urlencode(params)
|
||||
response, info = fetch_url(module, url, data=data, method='POST')
|
||||
response, info = fetch_url(module, url, data=data, method="POST")
|
||||
except Exception as e:
|
||||
module.fail_json(msg=f'Unable to notify Rollbar: {e}', exception=traceback.format_exc())
|
||||
module.fail_json(msg=f"Unable to notify Rollbar: {e}", exception=traceback.format_exc())
|
||||
else:
|
||||
if info['status'] == 200:
|
||||
if info["status"] == 200:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
module.fail_json(msg=f"HTTP result code: {info['status']} connecting to {url}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue