mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-02 10:20:31 +08:00
Add --insecure option just like curl has
This commit is contained in:
@@ -238,7 +238,7 @@ def get_scm_branch(branch):
|
||||
branch = out[:-1] # remove new-line
|
||||
return branch
|
||||
|
||||
def submit_module_build(scm_url, branch, server, id_provider, pyrpkg):
|
||||
def submit_module_build(scm_url, branch, server, id_provider, pyrpkg, verify=True):
|
||||
"""
|
||||
Submits the module defined by `scm_url` to MBS instance defined
|
||||
by `server`. Returns build_id or negative error code.
|
||||
@@ -252,7 +252,7 @@ def submit_module_build(scm_url, branch, server, id_provider, pyrpkg):
|
||||
body = {'scmurl': scm_url, 'branch': branch}
|
||||
resp = send_authorized_request(
|
||||
"POST", server, id_provider, "/module-build-service/1/module-builds/",
|
||||
body)
|
||||
body, verify=verify)
|
||||
logging.info(resp.text)
|
||||
|
||||
data = resp.json()
|
||||
@@ -277,7 +277,7 @@ def do_local_build(scm_url, branch):
|
||||
process.communicate()
|
||||
return process.returncode
|
||||
|
||||
def cancel_module_build(server, id_provider, build_id):
|
||||
def cancel_module_build(server, id_provider, build_id, verify=True):
|
||||
"""
|
||||
Cancels the module build.
|
||||
"""
|
||||
@@ -285,7 +285,7 @@ def cancel_module_build(server, id_provider, build_id):
|
||||
resp = send_authorized_request(
|
||||
"PATCH", server, id_provider,
|
||||
"/module-build-service/1/module-builds/" + str(build_id),
|
||||
{'state': 'failed'})
|
||||
{'state': 'failed'}, verify=verify)
|
||||
logging.info(resp.text)
|
||||
|
||||
def show_overview(server, finished, limit=30):
|
||||
@@ -365,6 +365,8 @@ def main():
|
||||
help="shows verbose output")
|
||||
parser.add_argument('-q', dest='quiet', action='store_true',
|
||||
help="shows only warnings and errors")
|
||||
parser.add_argument('-k', '--insecure', dest='verify', action='store_false',
|
||||
help="allow connections to SSL sites without certs")
|
||||
parser.add_argument('-s', dest='server', action='store',
|
||||
help="defines the hostname[:port] of the Module Build Service")
|
||||
parser.add_argument('-i', dest='idprovider', action='store',
|
||||
@@ -432,7 +434,7 @@ def main():
|
||||
if args.cmd_name == "submit":
|
||||
# Submit the module build.
|
||||
build_id = submit_module_build(args.scm_url, args.branch, args.server,
|
||||
args.idprovider, args.pyrpkg_client)
|
||||
args.idprovider, args.pyrpkg_client, args.verify)
|
||||
if build_id < 0:
|
||||
sys.exit(build_id)
|
||||
|
||||
@@ -450,7 +452,7 @@ def main():
|
||||
pass
|
||||
elif args.cmd_name == "cancel":
|
||||
# Cancel the module build
|
||||
cancel_module_build(args.server, args.idprovider, args.build_id)
|
||||
cancel_module_build(args.server, args.idprovider, args.build_id, args.verify)
|
||||
elif args.cmd_name == "overview":
|
||||
show_overview(args.server, finished=args.finished, limit=args.limit)
|
||||
elif args.cmd_name == "info":
|
||||
|
||||
Reference in New Issue
Block a user