Attention List #4

Closed
sgode wants to merge 16 commits from (deleted):attention_list into main
Showing only changes of commit 8c13133c60 - Show all commits

View File

@ -76,7 +76,7 @@ def get_args():
help='Git hoster to be queried for failed Pull Requests.\n' help='Git hoster to be queried for failed Pull Requests.\n'
'Default: [github, gitea].' 'Default: [github, gitea].'
) )
return(parser.parse_args()) return parser.parse_args()
def get_gitea_repos(url, headers, gitea_org): def get_gitea_repos(url, headers, gitea_org):
repositories = [] repositories = []
@ -99,7 +99,7 @@ def get_gitea_repos(url, headers, gitea_org):
print("The request status is: " + str(res.status_code) + print("The request status is: " + str(res.status_code) +
" | " + str(res.reason)) " | " + str(res.reason))
break break
return(repositories) return repositories
def get_gitea_prs(url, headers, gitea_org, repo): def get_gitea_prs(url, headers, gitea_org, repo):
pullrequests = [] pullrequests = []
@ -116,7 +116,7 @@ def get_gitea_prs(url, headers, gitea_org, repo):
print("The request status is: " + str(res.status_code) + print("The request status is: " + str(res.status_code) +
" | " + str(res.reason)) " | " + str(res.reason))
exit() exit()
return(pullrequests) return pullrequests
Outdated
Review

you can either use existing SDK or at least make a wrapper for requests so that you do not repeat the same exception handling block over and over again (smth like in https://review.opendev.org/c/zuul/zuul/+/850008/10/zuul/driver/gitea/giteaconnection.py#364 or in https://github.com/opentelekomcloud/ansible-collection-gitcontrol/tree/main/plugins/module_utils)

you can either use existing SDK or at least make a wrapper for requests so that you do not repeat the same exception handling block over and over again (smth like in https://review.opendev.org/c/zuul/zuul/+/850008/10/zuul/driver/gitea/giteaconnection.py#364 or in https://github.com/opentelekomcloud/ansible-collection-gitcontrol/tree/main/plugins/module_utils)
def get_failed_gitea_commits(pull, url, gitea_org, repo, headers): def get_failed_gitea_commits(pull, url, gitea_org, repo, headers):
failed_commits = [] failed_commits = []
@ -142,7 +142,7 @@ def get_failed_gitea_commits(pull, url, gitea_org, repo, headers):
" | " + str(res_sta.reason)) " | " + str(res_sta.reason))
print(json.dumps(res_sta.json())) print(json.dumps(res_sta.json()))
exit() exit()
return(failed_commits) return failed_commits
def get_github_repos(url, headers, gh_org): def get_github_repos(url, headers, gh_org):
repositories = [] repositories = []
@ -164,7 +164,7 @@ def get_github_repos(url, headers, gh_org):
print("The request status is: " + str(res.status_code) + print("The request status is: " + str(res.status_code) +
" | " + str(res.reason)) " | " + str(res.reason))
break break
return(repositories) return repositories
def get_github_prs(url, headers, gh_org, repo): def get_github_prs(url, headers, gh_org, repo):
pullrequests = [] pullrequests = []
@ -187,7 +187,7 @@ def get_github_prs(url, headers, gh_org, repo):
print("The request status is: " + str(res.status_code) + print("The request status is: " + str(res.status_code) +
" | " + str(res.reason)) " | " + str(res.reason))
break break
return(pullrequests) return pullrequests
def get_failed_gh_commits(pull, url, gh_org, repo, headers): def get_failed_gh_commits(pull, url, gh_org, repo, headers):
failed_commits = [] failed_commits = []
@ -226,13 +226,10 @@ def get_failed_gh_commits(pull, url, gh_org, repo, headers):
" | " + str(res_sta.reason)) " | " + str(res_sta.reason))
print(json.dumps(res_sta.json())) print(json.dumps(res_sta.json()))
exit() exit()
return(failed_commits) return failed_commits
def main(): def main():
args = get_args() args = get_args()
failed_commits = [] failed_commits = []
if args.debug: if args.debug: