mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-24 22:27:24 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -81,42 +81,42 @@ def main():
|
|||
argument_spec=dict(
|
||||
organization=dict(required=True),
|
||||
repo=dict(required=True),
|
||||
issue=dict(type='int', required=True),
|
||||
action=dict(choices=['get_status'], default='get_status'),
|
||||
issue=dict(type="int", required=True),
|
||||
action=dict(choices=["get_status"], default="get_status"),
|
||||
),
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
organization = module.params['organization']
|
||||
repo = module.params['repo']
|
||||
issue = module.params['issue']
|
||||
action = module.params['action']
|
||||
organization = module.params["organization"]
|
||||
repo = module.params["repo"]
|
||||
issue = module.params["issue"]
|
||||
action = module.params["action"]
|
||||
|
||||
result = dict()
|
||||
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/vnd.github.v3+json',
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
}
|
||||
|
||||
url = f"https://api.github.com/repos/{organization}/{repo}/issues/{issue}"
|
||||
|
||||
response, info = fetch_url(module, url, headers=headers)
|
||||
if not (200 <= info['status'] < 400):
|
||||
if info['status'] == 404:
|
||||
if not (200 <= info["status"] < 400):
|
||||
if info["status"] == 404:
|
||||
module.fail_json(msg=f"Failed to find issue {issue}")
|
||||
module.fail_json(msg=f"Failed to send request to {url}: {info['msg']}")
|
||||
|
||||
gh_obj = json.loads(response.read())
|
||||
|
||||
if action == 'get_status' or action is None:
|
||||
if action == "get_status" or action is None:
|
||||
if module.check_mode:
|
||||
result.update(changed=True)
|
||||
else:
|
||||
result.update(changed=True, issue_status=gh_obj['state'])
|
||||
result.update(changed=True, issue_status=gh_obj["state"])
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue