From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364460; cv=none; d=zoho.com; s=zohoarc; b=h8X51ZUwV6SoSZUQmsVaiJKUWUvPYQAhdVHDKuvQEx1qMM8gG4SuahqSt8GmOvJvmbN1BIsUEs6JYCzyrbVNzkD0wHnyCjQVEO4d0gKurBUzhdCktWw8Ik8UJjsGPGbFhT+ND//oSpO7QKE0VBu6zkiN0iyKKfcCKBe+CL5Va3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364460; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VeMqTiLobLabiL1T5PAiBs/qMhZFn3Wws3pTTFMzvyI=; b=QgVW1wv2TlzVNp2KPZiFYiD4gVJHleWUmFs0TRXXT6OtpW/fbm5y7/R5zgI3wWyvC1Hlgu9LvOcb7ZLW8dfqiD1Q/ENi4pxqPW/FtLqhURricaZAdxZJFyVPLu9mpPaA2UB/0Mz0viecRudRIOVJZSYN4yTJpd6aMsziPzQVGdg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364460732399.7892905444063; Wed, 17 Jul 2019 04:54:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DE7B335C1; Wed, 17 Jul 2019 11:54:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB5B25B685; Wed, 17 Jul 2019 11:54:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2D1C018045CE; Wed, 17 Jul 2019 11:54:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsEqf031349 for ; Wed, 17 Jul 2019 07:54:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 835E91001B27; Wed, 17 Jul 2019 11:54:14 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB9FE1001B00 for ; Wed, 17 Jul 2019 11:54:13 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:50 +0200 Message-Id: <20190717115409.1452-2-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 01/20] quayadmin: Import initial implementation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 17 Jul 2019 11:54:18 +0000 (UTC) This code was written by Daniel P. Berrang=C3=A9, and contains the scaffolding necessary to call Quay APIs as well as the implementation of a few commands. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 198 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 198 insertions(+) create mode 100755 guests/quayadmin diff --git a/guests/quayadmin b/guests/quayadmin new file mode 100755 index 0000000..31ea929 --- /dev/null +++ b/guests/quayadmin @@ -0,0 +1,198 @@ +#!/usr/bin/python3 +# -*- python -*- +# +# quayadmin - client for quay.io +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . + +import argparse +import requests +import sys + +baseurl =3D "https://quay.io/api/v1" +clientid =3D "xxx" +clientsecret =3D "xxx" +token=3D "xxx" + + +def request(endpoint, method, payload=3DNone, params=3DNone): + url =3D baseurl + endpoint + + headers =3D { + "Authorization": "Bearer {}".format(token) + } + + return method(url, headers=3Dheaders, json=3Dpayload, params=3Dparams) + + +def get(endpoint, params=3DNone): + return request(endpoint, method=3Drequests.get, params=3Dparams) + + +def delete(endpoint, payload=3DNone): + return request(endpoint, method=3Drequests.delete, payload=3Dpayload) + + +def post(endpoint, payload=3DNone): + return request(endpoint, method=3Drequests.post, payload=3Dpayload) + + +def has_error(quiet, res, expected, message): + if res.status_code =3D=3D expected: + return False + + if res.status_code >=3D 400 and res.status_code < 500: + info =3D res.json() + err =3D info["error_message"] + else: + err =3D res.content + + if not quiet: + print("{}: {} ({})".format(message, err, res.status_code)) + return True + + +def run_list_repos(args): + res =3D get("/repository", params=3D{"namespace": args.namespace}) + + if has_error(args.quiet, res, 200, "Cannot list repositories"): + return 1 + + info =3D res.json() + for repo in info["repositories"]: + print ("{}/{}".format(repo["namespace"], repo["name"])) + + +def run_show_repo(args): + res =3D get("/repository/{}/{}".format(args.namespace, args.repo)) + + if has_error(args.quiet, res, 200, "Cannot query repository {}/{}" + .format(args.namespace, args.repo)): + return 1 + + info =3D res.json() + if not args.quiet: + print("{}/{}: {}".format(args.namespace, args.repo, info["descript= ion"])) + + +def run_create_repo(args): + res =3D post("/repository", payload=3D{ + "repo_kind": "image", + "namespace": args.namespace, + "visibility": "public", + "repository": args.repo, + "description": args.desc, + }) + + if has_error(args.quiet, res, 201, "Cannot create repository {}/{}" + .format(args.namespace, args.repo)): + return 1 + + if not args.quiet: + print("Repository {}/{} created".format(args.namespace, args.repo)) + + +def run_delete_repo(args): + res =3D delete("/repository/{}/{}".format(args.namespace, args.repo)) + + if has_error(args.quiet, res, 204, "Cannot delete repository {}/{}" + .format(args.namespace, args.repo)): + return 1 + + if not args.quiet: + print("Repository {}/{} deleted".format(args.namespace, args.repo)) + + +def add_arg_namespace(parser): + parser.add_argument("namespace", help=3D"Organization or user name") + + +def add_arg_repo(parser): + parser.add_argument("repo", help=3D"Repository name") + + +def add_arg_desc(parser): + parser.add_argument("desc", help=3D"Repository description") + + +def build_parser_list_repos(subparser): + parser =3D subparser.add_parser("list-repos", help=3D"List container r= epositories") + + parser.set_defaults(func=3Drun_list_repos) + + add_arg_namespace(parser) + + +def build_parser_create_repo(subparser): + parser =3D subparser.add_parser("create-repo", help=3D"Create a new re= pository") + + parser.set_defaults(func=3Drun_create_repo) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_desc(parser) + + +def build_parser_show_repo(subparser): + parser =3D subparser.add_parser("show-repo", help=3D"Show repository i= nfo") + + parser.set_defaults(func=3Drun_show_repo) + + add_arg_namespace(parser) + add_arg_repo(parser) + + +def build_parser_delete_repo(subparser): + parser =3D subparser.add_parser("delete-repo", help=3D"Delete an exist= ing repository") + + parser.set_defaults(func=3Drun_create_repo) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_desc(parser) + + +def build_parser(): + parser =3D argparse.ArgumentParser( + description=3D"quay.io client admin tool" + ) + + parser.add_argument("--debug", '-d', action=3D"store_true", help=3D"Pr= int debugging information") + parser.add_argument("--quiet", '-q', action=3D"store_true", help=3D"Di= splay minimal information") + + subparser =3D parser.add_subparsers(metavar=3D"COMMAND") + subparser.required =3D True + + build_parser_list_repos(subparser) + build_parser_show_repo(subparser) + build_parser_create_repo(subparser) + build_parser_delete_repo(subparser) + + return parser + +def main(): + parser =3D build_parser() + args =3D parser.parse_args() + + try: + res =3D args.func(args) + sys.exit(res) + except Exception as ex: + sys.stderr.write("{}: {}\n".format(sys.argv[0], ex)) + sys.exit(1) + +if __name__ =3D=3D "__main__": + main() --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364472; cv=none; d=zoho.com; s=zohoarc; b=O+4iBFNu5bNgXMaxiGBQphd+PQKrmFHdpcxLJdCtT1rIFlK8YiaWqZEjikt7Dm9PEWNAHxtHjm2TR3oH+ZHrDS/gqyO44fjJfpFw+uAfTeFZMjcWzRjWBMBur7u+TqB54j1GI4Y5LnXBe89krZuwt6o5wDfTbduj68uLJy4PFSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364472; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=echSWJra31NgI3Lo/OioyK1OwYuPnBZKs1x63ZHvLL8=; b=jffB67uJuWZFN6TXMEAdFgwADDI4CCmnJF6+TndCr51bSnwzqx9bkU9fdNNyLn045vofsTEqDnJxxrXxsubqZHbhaV4aDicJOmPivvNEi7MSgBlH0QErTF+rF5zXbVIG2Pn6OfE2yi9imnzvP1WTgCssTaRJ4cNA+1XmGj5yL2o= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364472275645.7704895032372; Wed, 17 Jul 2019 04:54:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9EA986671; Wed, 17 Jul 2019 11:54:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C40410190A9; Wed, 17 Jul 2019 11:54:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4215D180020B; Wed, 17 Jul 2019 11:54:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsFuK031358 for ; Wed, 17 Jul 2019 07:54:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5018E1001B2C; Wed, 17 Jul 2019 11:54:15 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF33D1001B00 for ; Wed, 17 Jul 2019 11:54:14 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:51 +0200 Message-Id: <20190717115409.1452-3-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 02/20] quayadmin: Fix argument parsing for delete-repo X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 17 Jul 2019 11:54:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" It was clearly copied from create-repo and not cleaned up sufficiently afterwards. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 31ea929..5dc5eff 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -158,11 +158,10 @@ def build_parser_show_repo(subparser): def build_parser_delete_repo(subparser): parser =3D subparser.add_parser("delete-repo", help=3D"Delete an exist= ing repository") =20 - parser.set_defaults(func=3Drun_create_repo) + parser.set_defaults(func=3Drun_delete_repo) =20 add_arg_namespace(parser) add_arg_repo(parser) - add_arg_desc(parser) =20 =20 def build_parser(): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364472; cv=none; d=zoho.com; s=zohoarc; b=Kv123mP+TnafDtsj/8F6UkkptuVztI7RBE2tOXMA7YkElfSEabkhg/Dy2VT+SAdsdkxBCtlBCIYar7OSaX9WwQgUFh+UKtp5//7vuM317nR4CRstmTY0FqFbqJQYMnvoXQFG+F3TWU3cSiDViH/rgHSGvJSwTlUG5mrc72/qxXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364472; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=xq+c2AsihV8vzpWLCvjESAfNVwHkQ7yIO5NBI7MB3v0=; b=glnbvvHPc3Tk00/2KOs6j/XGXHKuev+jrHcKJPpWTABQrOwtD1LR6tzfWvVmhRoLXutBmdW6CcVI3PJfh7859dZMAhl4Xb2d0Bzlyen4kWN01zxpZfD8LznZp0KZjkI0E12u0bL247UwwTzhl7ATcuVSbti4YZIstPS7q5Qa4fI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156336447283484.6615378172313; Wed, 17 Jul 2019 04:54:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 11D32300C724; Wed, 17 Jul 2019 11:54:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E190A5D9CA; Wed, 17 Jul 2019 11:54:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9B1E74EA62; Wed, 17 Jul 2019 11:54:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsGB4031363 for ; Wed, 17 Jul 2019 07:54:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DE081001B27; Wed, 17 Jul 2019 11:54:16 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9C3E61001B00 for ; Wed, 17 Jul 2019 11:54:15 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:52 +0200 Message-Id: <20190717115409.1452-4-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 03/20] quayadmin: Fix quiet mode for show-repo X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 17 Jul 2019 11:54:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Since the user is explicity asking for information to be displayed, we should present it to them whether or not quiet mode is enabled. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 5dc5eff..980fc1b 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -84,8 +84,8 @@ def run_show_repo(args): return 1 =20 info =3D res.json() - if not args.quiet: - print("{}/{}: {}".format(args.namespace, args.repo, info["descript= ion"])) + + print("{}/{}: {}".format(args.namespace, args.repo, info["description"= ])) =20 =20 def run_create_repo(args): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364476; cv=none; d=zoho.com; s=zohoarc; b=K7kix+4J9mCdAq0RYd0T8YLMQZnWxu2QIROVtZ4etYeMOWuMQNfqGAvOrtcJxn8xB7bs7DyEKm0R6fXlW9kyE4I4hbnAcvQGsOTD5wWzrdYD7wITUuvEbf9qKIz271sL4yrKC9o+lUP4G30IOr3yWIo8WqbtqWeJiqYj3r3KXCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364476; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=S6FMvQJW2UsC1eEs84ujinBuTbYWEFUL0Z5kVMaLfN0=; b=b46RkUL+uPof9lSt23a8Cqe7IuCGG34s5BTdXTEwqqhkp0y0IVcxBVwnDUm3wWBW4DdXRrVTjhGdZdvWZpfUYBy30L4ViKUPcW/3oUT+fci6hNckWUSnrq1t/pxULCiZFQTp3vRHF8zGbF5pdTS5hNCbmZhCCYTrQUvMIirKQiY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364476283175.2093297871569; Wed, 17 Jul 2019 04:54:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 656C8A7F8; Wed, 17 Jul 2019 11:54:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3AD5160BF4; Wed, 17 Jul 2019 11:54:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0462941F63; Wed, 17 Jul 2019 11:54:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsGI3031373 for ; Wed, 17 Jul 2019 07:54:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id DFAF61001B27; Wed, 17 Jul 2019 11:54:16 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 697D91001B00 for ; Wed, 17 Jul 2019 11:54:16 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:53 +0200 Message-Id: <20190717115409.1452-5-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 04/20] quayadmin: Tweak show-repo output format X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 17 Jul 2019 11:54:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We're going to introduce several other show-* commands later, and we want their output to be more or less consistent, so start by tweaking the existing command. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guests/quayadmin b/guests/quayadmin index 980fc1b..cec0e64 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -85,7 +85,10 @@ def run_show_repo(args): =20 info =3D res.json() =20 - print("{}/{}: {}".format(args.namespace, args.repo, info["description"= ])) + print("repo:") + print(" namespace: {}".format(args.namespace)) + print(" repo: {}".format(args.repo)) + print(" description: {}".format(info["description"])) =20 =20 def run_create_repo(args): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364480; cv=none; d=zoho.com; s=zohoarc; b=DXvfRc9HkE2SSEvv9KadseSC5ThV4F3ff9/nx7bgj+ZfoXNZiIXMHMLNrr8B/p/G3kP6k8Ksq0bkSQD2ifFR9O7RxIOBRX1/53wdcxOElfaDq3FLbzaFZWAuKoOCmOBIpaDctUoGH6rbuEd3Z5RdPDth8QAttL/HD7ioWdfux/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364480; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=z1lsj5wGimLJZ65MoLD+G8XzHKqBXMdhQ4MlNCI8RrE=; b=VD/IkUAMclYtWqW2y0Ydxy6OhxrwELa8p8JaSY5pe5j/yZKa5Niq7e/GCGux+sschDWezs57lU8If2GEvKmnVRLO2dMdjhkGwY4wT5HjAGujxbUjbuBpqqVkUfmScSO7w33Sx9l7RcjUydXN00q8QXkUbVbWiDoIc+opgCy2D3g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364480462917.1747571576244; Wed, 17 Jul 2019 04:54:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8C45307D853; Wed, 17 Jul 2019 11:54:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1AF91E7; Wed, 17 Jul 2019 11:54:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E7DB18045D1; Wed, 17 Jul 2019 11:54:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsHSh031383 for ; Wed, 17 Jul 2019 07:54:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE8FC1001B27; Wed, 17 Jul 2019 11:54:17 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38E811001B00 for ; Wed, 17 Jul 2019 11:54:17 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:54 +0200 Message-Id: <20190717115409.1452-6-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 05/20] quayadmin: Tweak list-repos output format X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 17 Jul 2019 11:54:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We're going to introduce several other list-* commands later, and we want their output to be more or less consistent, so start by tweaking the existing command. More specifically, we want the output of each list-* command to be such that you can take one of the lines, append it to the arguments you just used and by doing so obtain a valid list of arguments for the corresponding show-* command, eg. $ quayadmin list-repos libvirt buildenv-debian-10 $ quayadmin show-repo libvirt buildenv-debian-10 repo: namespace: libvirt repo: buildenv-debian-10 $ Signed-off-by: Andrea Bolognani --- guests/quayadmin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guests/quayadmin b/guests/quayadmin index cec0e64..ed10bfc 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -73,7 +73,7 @@ def run_list_repos(args): =20 info =3D res.json() for repo in info["repositories"]: - print ("{}/{}".format(repo["namespace"], repo["name"])) + print ("{}".format(repo["name"])) =20 =20 def run_show_repo(args): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364482; cv=none; d=zoho.com; s=zohoarc; b=Nf/S9U+STxYZEjrRJFmzV+9+J0eth3nlsn5Vs1lfFZDsn5KwEu3C1Iz+Xn8DBYdpjyg1FB8Ia35AlQespED99QROjxuHx+Aun738pTrL+mZ1YBM7e6jxNvewmXU8jPyMxE/Y2dvGHCZuo05p1gI5isiZBdEIVAn7BtTJpwLjO3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364482; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=K1HXJCvSa3iefDEw1kQfX2NADQb4Fe9fMy3MFnsgkJE=; b=EiUS/jGBKkN6x5ED2cx9eYyiyy1KyZTw07RG1HppflJ0CRlAMpxpDfyf1Q4vjNYb/WXXsVuX4NA4rntMgyoL7CZ7SMVHjqD/FkrPyH9q/dFfz4ztItfpY2s49yfQQYAcGQL89DuaeCkNute8r67w9yOOw4daznHbsfOg0fr0Q8Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364482798691.9182394988695; Wed, 17 Jul 2019 04:54:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1DE42307D86F; Wed, 17 Jul 2019 11:54:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E99203798; Wed, 17 Jul 2019 11:54:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AA8B418045D6; Wed, 17 Jul 2019 11:54:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsIEU031388 for ; Wed, 17 Jul 2019 07:54:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7C82E1001B27; Wed, 17 Jul 2019 11:54:18 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0716A1001B00 for ; Wed, 17 Jul 2019 11:54:17 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:55 +0200 Message-Id: <20190717115409.1452-7-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 06/20] quayadmin: Build endpoint, params and payload separately X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 17 Jul 2019 11:54:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Instead of building all arguments for a request at the same time as the request itself is prepared, build them beforehand and then pass them to the corresponding function. This makes the code more readable, especially when complex params or long endpoints are involved. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index ed10bfc..e2b34e0 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -66,18 +66,26 @@ def has_error(quiet, res, expected, message): =20 =20 def run_list_repos(args): - res =3D get("/repository", params=3D{"namespace": args.namespace}) + endpoint =3D "/repository" + params =3D { + "namespace": args.namespace, + } + + res =3D get(endpoint, params=3Dparams) =20 if has_error(args.quiet, res, 200, "Cannot list repositories"): return 1 =20 info =3D res.json() + for repo in info["repositories"]: print ("{}".format(repo["name"])) =20 =20 def run_show_repo(args): - res =3D get("/repository/{}/{}".format(args.namespace, args.repo)) + endpoint =3D "/repository/{}/{}".format(args.namespace, args.repo) + + res =3D get(endpoint) =20 if has_error(args.quiet, res, 200, "Cannot query repository {}/{}" .format(args.namespace, args.repo)): @@ -92,13 +100,16 @@ def run_show_repo(args): =20 =20 def run_create_repo(args): - res =3D post("/repository", payload=3D{ + endpoint =3D "/repository" + payload =3D { "repo_kind": "image", "namespace": args.namespace, "visibility": "public", "repository": args.repo, "description": args.desc, - }) + } + + res =3D post(endpoint, payload=3Dpayload) =20 if has_error(args.quiet, res, 201, "Cannot create repository {}/{}" .format(args.namespace, args.repo)): @@ -109,7 +120,9 @@ def run_create_repo(args): =20 =20 def run_delete_repo(args): - res =3D delete("/repository/{}/{}".format(args.namespace, args.repo)) + endpoint =3D "/repository/{}/{}".format(args.namespace, args.repo) + + res =3D delete(endpoint) =20 if has_error(args.quiet, res, 204, "Cannot delete repository {}/{}" .format(args.namespace, args.repo)): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364475; cv=none; d=zoho.com; s=zohoarc; b=kfsM+FYIHRLUSXJVc5GumobLuL9BWQp80IsGbhfAkrBIMwYuzDWZImKuQyriM6jTE6j0ivPlxvM2eSLugWrJFEi6JJ1JDtgiijpNvvdBTSp4pWsFczF8pIVeMN77O1rsg9EewE1OwGq+V9ZzP9HSURZOS6JK5tFKJGL1/aANtwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364475; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aGBY5z1rCBx339oqrltkm3eTX9wwyyXTcCK7g9WBL0E=; b=BIhGQ59ftgOGwaqmssvuLoEsV98rP/da/4Zvrl2tRSWUy1X94RSs4FxMSiKO/jljTMM1G8zLR0fqlyHQm2V5XkfyLQMr8C9UOF0pL4LOIKzb2ydmD/4XVEVyUeA90WwWevzx9iLRPzx/dosJ2z5y/4YlwQWWaZM3AhPiTtLqP78= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364475898534.0024033672535; Wed, 17 Jul 2019 04:54:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CC6D300CB2C; Wed, 17 Jul 2019 11:54:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9EDE17C41; Wed, 17 Jul 2019 11:54:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9E29B54D3D; Wed, 17 Jul 2019 11:54:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsJfU031396 for ; Wed, 17 Jul 2019 07:54:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B7261001B0E; Wed, 17 Jul 2019 11:54:19 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8A6E1001B00 for ; Wed, 17 Jul 2019 11:54:18 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:56 +0200 Message-Id: <20190717115409.1452-8-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 07/20] quayadmin: Implement debug mode X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 17 Jul 2019 11:54:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" While a command line parameter for enabling debug mode has been defined, it's not currently used in any form or shape. Make it so enabling debug mode actually does something useful, that is, prints the most important parts of the conversation happening between the client and the server. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index e2b34e0..c40f71f 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -19,6 +19,7 @@ # with this program. If not, see . =20 import argparse +import pprint import requests import sys =20 @@ -28,26 +29,42 @@ clientsecret =3D "xxx" token=3D "xxx" =20 =20 -def request(endpoint, method, payload=3DNone, params=3DNone): +def request(endpoint, method, payload=3DNone, params=3DNone, debug=3DFalse= ): url =3D baseurl + endpoint =20 headers =3D { "Authorization": "Bearer {}".format(token) } =20 - return method(url, headers=3Dheaders, json=3Dpayload, params=3Dparams) + if debug: + print("=3D> {") + print(" url=3D{}".format(url)) + print(" params=3D{}".format(pprint.pformat(params))) + print(" payload=3D{}".format(pprint.pformat(payload))) + print("}") =20 + res =3D method(url, headers=3Dheaders, json=3Dpayload, params=3Dparams) =20 -def get(endpoint, params=3DNone): - return request(endpoint, method=3Drequests.get, params=3Dparams) + if debug: + print("<=3D {") + print(" status_code=3D{}".format(res.status_code)) + if res.text is not None and len(res.text) > 0: + print(" json=3D{}".format(pprint.pformat(res.json()))) + print("}") =20 + return res =20 -def delete(endpoint, payload=3DNone): - return request(endpoint, method=3Drequests.delete, payload=3Dpayload) =20 +def get(endpoint, params=3DNone, debug=3DFalse): + return request(endpoint, method=3Drequests.get, params=3Dparams, debug= =3Ddebug) =20 -def post(endpoint, payload=3DNone): - return request(endpoint, method=3Drequests.post, payload=3Dpayload) + +def delete(endpoint, payload=3DNone, debug=3DFalse): + return request(endpoint, method=3Drequests.delete, payload=3Dpayload, = debug=3Ddebug) + + +def post(endpoint, payload=3DNone, debug=3DFalse): + return request(endpoint, method=3Drequests.post, payload=3Dpayload, de= bug=3Ddebug) =20 =20 def has_error(quiet, res, expected, message): @@ -71,7 +88,7 @@ def run_list_repos(args): "namespace": args.namespace, } =20 - res =3D get(endpoint, params=3Dparams) + res =3D get(endpoint, params=3Dparams, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 200, "Cannot list repositories"): return 1 @@ -85,7 +102,7 @@ def run_list_repos(args): def run_show_repo(args): endpoint =3D "/repository/{}/{}".format(args.namespace, args.repo) =20 - res =3D get(endpoint) + res =3D get(endpoint, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 200, "Cannot query repository {}/{}" .format(args.namespace, args.repo)): @@ -109,7 +126,7 @@ def run_create_repo(args): "description": args.desc, } =20 - res =3D post(endpoint, payload=3Dpayload) + res =3D post(endpoint, payload=3Dpayload, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 201, "Cannot create repository {}/{}" .format(args.namespace, args.repo)): @@ -122,7 +139,7 @@ def run_create_repo(args): def run_delete_repo(args): endpoint =3D "/repository/{}/{}".format(args.namespace, args.repo) =20 - res =3D delete(endpoint) + res =3D delete(endpoint, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 204, "Cannot delete repository {}/{}" .format(args.namespace, args.repo)): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364486; cv=none; d=zoho.com; s=zohoarc; b=JzWe2kDb3qkmJVyo2k5zJtUi7orwUfs/o3YLurI4Iq5cX1upA2veBC7S+mKU5QalHb93wAtZz2JsKrr23eFD3TBpMcOMfKs+gjdL71GFq01SWe0w9mjo8WtjMF0wcYGmpfD7yBsk1wwhpmhidR0v4MQ+GGy5425XL/awKHdZeD4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364486; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2xxnZnmTEPn1CNnWw30ICAGd4B5UL1bHZRTetKFdrfo=; b=ZUpJsr0KVK/K/DEUJz/7AWlitMSRZEIo7n2oyjDjKEJ5r8qO7ZPdXtf6mEr0n29VKSAju5xFD8kMavE687V3KHEhR1kH/pP6wVEHUld9TSVoTwkmUVrI00qprNB0F/lajSnhk/0VCPgg/6rVk606UiUHZ10HN6myjEOzR+TCdEA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364486034309.2393672686784; Wed, 17 Jul 2019 04:54:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63304C060204; Wed, 17 Jul 2019 11:54:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BAF55C28C; Wed, 17 Jul 2019 11:54:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F03B118045DD; Wed, 17 Jul 2019 11:54:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsKk5031406 for ; Wed, 17 Jul 2019 07:54:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1D8F2102470C; Wed, 17 Jul 2019 11:54:20 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 96E3E1001B21 for ; Wed, 17 Jul 2019 11:54:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:57 +0200 Message-Id: <20190717115409.1452-9-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 08/20] quayadmin: Remove clientid and clientsecret X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 17 Jul 2019 11:54:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" They're not currently used, and don't look like they're actually necessary to use the Quay API. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 2 -- 1 file changed, 2 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index c40f71f..7c503a4 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -24,8 +24,6 @@ import requests import sys =20 baseurl =3D "https://quay.io/api/v1" -clientid =3D "xxx" -clientsecret =3D "xxx" token=3D "xxx" =20 =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364480; cv=none; d=zoho.com; s=zohoarc; b=XUQwZMA1mDExYVx+x1540Bk3/JzZAtkWJq7DwVI4xpenDGGw1pYWHUTZH9R4voDyZ+o4AB6ydi9oRHHTTs7PdQJQkwFtpYoGT79gf7NFj1nNmCzw53zigGoThLehI0wJqMH3Ts/dyo2T6Fu+JmTxzKyRUihm7JYtoRupaSn1/6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364480; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6dLnvOcEnutHYgHvktRgMV4Cpqn86R7ZjZcb0eeyL8Y=; b=KHYnKtNpw1UWJah2l4CfNMg5VnkWTItKLzTsrzLAG3uGO2bX3/IVFPaiX5O6i8UXjObumXj6KaCKjq2EoLygvztcR1C7NqNJmhwc542ytkLDhHL3KreerCo+g+35X4kn3qtvYXDKzCNjvQMTcGsc/efs7G7LnJxSGQGeej810Mg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364480362212.06650180784027; Wed, 17 Jul 2019 04:54:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AC9019CF7A; Wed, 17 Jul 2019 11:54:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 61DBE60C70; Wed, 17 Jul 2019 11:54:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2593C18045CF; Wed, 17 Jul 2019 11:54:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsKtA031418 for ; Wed, 17 Jul 2019 07:54:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id E522C108426C; Wed, 17 Jul 2019 11:54:20 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D0A3104B507 for ; Wed, 17 Jul 2019 11:54:20 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:58 +0200 Message-Id: <20190717115409.1452-10-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 09/20] quayamdin: Introduce configuration object X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 17 Jul 2019 11:54:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Instead of storing the client configuration in global variables, create a single configuration object to store all of them and pass around for functions to use. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 7c503a4..25128e5 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -23,15 +23,20 @@ import pprint import requests import sys =20 -baseurl =3D "https://quay.io/api/v1" -token=3D "xxx" +def get_config(): + config =3D { + "baseurl": "https://quay.io/api/v1", + "token": "xxx", + } + + return config =20 =20 -def request(endpoint, method, payload=3DNone, params=3DNone, debug=3DFalse= ): - url =3D baseurl + endpoint +def request(config, endpoint, method, payload=3DNone, params=3DNone, debug= =3DFalse): + url =3D config["baseurl"] + endpoint =20 headers =3D { - "Authorization": "Bearer {}".format(token) + "Authorization": "Bearer {}".format(config["token"]) } =20 if debug: @@ -53,16 +58,16 @@ def request(endpoint, method, payload=3DNone, params=3D= None, debug=3DFalse): return res =20 =20 -def get(endpoint, params=3DNone, debug=3DFalse): - return request(endpoint, method=3Drequests.get, params=3Dparams, debug= =3Ddebug) +def get(config, endpoint, params=3DNone, debug=3DFalse): + return request(config, endpoint, method=3Drequests.get, params=3Dparam= s, debug=3Ddebug) =20 =20 -def delete(endpoint, payload=3DNone, debug=3DFalse): - return request(endpoint, method=3Drequests.delete, payload=3Dpayload, = debug=3Ddebug) +def delete(config, endpoint, payload=3DNone, debug=3DFalse): + return request(config, endpoint, method=3Drequests.delete, payload=3Dp= ayload, debug=3Ddebug) =20 =20 -def post(endpoint, payload=3DNone, debug=3DFalse): - return request(endpoint, method=3Drequests.post, payload=3Dpayload, de= bug=3Ddebug) +def post(config, endpoint, payload=3DNone, debug=3DFalse): + return request(config, endpoint, method=3Drequests.post, payload=3Dpay= load, debug=3Ddebug) =20 =20 def has_error(quiet, res, expected, message): @@ -80,13 +85,13 @@ def has_error(quiet, res, expected, message): return True =20 =20 -def run_list_repos(args): +def run_list_repos(config, args): endpoint =3D "/repository" params =3D { "namespace": args.namespace, } =20 - res =3D get(endpoint, params=3Dparams, debug=3Dargs.debug) + res =3D get(config, endpoint, params=3Dparams, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 200, "Cannot list repositories"): return 1 @@ -97,10 +102,10 @@ def run_list_repos(args): print ("{}".format(repo["name"])) =20 =20 -def run_show_repo(args): +def run_show_repo(config, args): endpoint =3D "/repository/{}/{}".format(args.namespace, args.repo) =20 - res =3D get(endpoint, debug=3Dargs.debug) + res =3D get(config, endpoint, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 200, "Cannot query repository {}/{}" .format(args.namespace, args.repo)): @@ -114,7 +119,7 @@ def run_show_repo(args): print(" description: {}".format(info["description"])) =20 =20 -def run_create_repo(args): +def run_create_repo(config, args): endpoint =3D "/repository" payload =3D { "repo_kind": "image", @@ -124,7 +129,7 @@ def run_create_repo(args): "description": args.desc, } =20 - res =3D post(endpoint, payload=3Dpayload, debug=3Dargs.debug) + res =3D post(config, endpoint, payload=3Dpayload, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 201, "Cannot create repository {}/{}" .format(args.namespace, args.repo)): @@ -134,10 +139,10 @@ def run_create_repo(args): print("Repository {}/{} created".format(args.namespace, args.repo)) =20 =20 -def run_delete_repo(args): +def run_delete_repo(config, args): endpoint =3D "/repository/{}/{}".format(args.namespace, args.repo) =20 - res =3D delete(endpoint, debug=3Dargs.debug) + res =3D delete(config, endpoint, debug=3Dargs.debug) =20 if has_error(args.quiet, res, 204, "Cannot delete repository {}/{}" .format(args.namespace, args.repo)): @@ -218,7 +223,7 @@ def main(): args =3D parser.parse_args() =20 try: - res =3D args.func(args) + res =3D args.func(get_config(), args) sys.exit(res) except Exception as ex: sys.stderr.write("{}: {}\n".format(sys.argv[0], ex)) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364483; cv=none; d=zoho.com; s=zohoarc; b=PAl57dj+BDkOWsXipF2wVB3MyAD3VYLSjX/zJJ80WcMDlWFCUgOByK4dU1Nqnx0iiFyIvizC/rD9m5OEOA1g6du43XYxlvHTCizXJhOyOiU2qshjTFSRLibspdOLY7ETgmyjBdn6zdQFaPlpJx9ZFlCOeLqhnmld6TnrSgDnFtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364483; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sdzrvyE8J/AI6ONLbCYyem7Qc2mOcyW187NMOtIXhbg=; b=j8cDefhpc3d7R1pGLOf5E74Tkd4GrRghZx7eBoZwqttW/zhpT97biLwqAve16BfhDJwSyDMtHpS7PUMGVxWgeeDNpha4uEq4hSj+HBPToS9jnv4d6M5yzfpBc757JA8jkw4pRRh7Y8tGQzuPwb3G+SI3ub7Qltpop15KRxWKgiA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364483098473.83608042770265; Wed, 17 Jul 2019 04:54:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D45D308FBA9; Wed, 17 Jul 2019 11:54:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AFAA35B689; Wed, 17 Jul 2019 11:54:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7252318045DA; Wed, 17 Jul 2019 11:54:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsLCm031423 for ; Wed, 17 Jul 2019 07:54:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id B94D410A394B; Wed, 17 Jul 2019 11:54:21 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F0751091EFD for ; Wed, 17 Jul 2019 11:54:21 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:53:59 +0200 Message-Id: <20190717115409.1452-11-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 10/20] quayadmin: Read configuration from file X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 17 Jul 2019 11:54:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We don't want sensitive information such as the API token to be stored into the script, both because it could lead to them being leaked by mistake and because it makes it needlessly complicated for users to take advantage of the tool. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 25128e5..4e60653 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -19,15 +19,32 @@ # with this program. If not, see . =20 import argparse +import configparser +import os import pprint import requests import sys =20 def get_config(): - config =3D { - "baseurl": "https://quay.io/api/v1", - "token": "xxx", - } + try: + path =3D os.environ["XDG_CONFIG_HOME"] + except KeyError: + path =3D os.path.join(os.environ["HOME"], ".config") + path =3D os.path.join(os.path.join(path, "quayadmin"), "config.ini") + + try: + parser =3D configparser.ConfigParser() + parser.read_file(open(path)) + except Exception as ex: + raise Exception("Cannot load config: {}".format(ex)) + + try: + config =3D { + "baseurl": "https://quay.io/api/v1", + "token": parser["DEFAULT"]["token"], + } + except KeyError: + raise Exception("Token not found in {}".format(path)) =20 return config =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364489; cv=none; d=zoho.com; s=zohoarc; b=kHFcE6iJilZWRMz3bV9yx9BXyq99ShlEkLosOF80vHCvDCB/aTE5jdHam2QYbdOqY+6CYQkhcQ5yHTjwrRvJy8sf431TZBOnijytnsg0/nLo/j+5l/iEWpZyVNMbOyZt7EcsU56yAsEj6Pk/v54ZYehHVD+C2iEeqYLdID2c0gQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364489; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Rd4OunA2/HIdrSTGkS1yVAXdhzQPNbRtHnqrH1Zx1rI=; b=V41Bb2hzODEcvWsmUsCureycEwek4DqYBXcoS/DlCpBnCRZUS1xBKf1HvMNsmlheLlTpeQzRWd5QxTzzx+GTtePVk088WT3rCkUWQQnLHQiF2NlMRaORVBiEWXEXp8f25AKiQPrEfthUdE5Z5Ij7A4ZLP0va4a0mlS6iflU/bNc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156336448982860.35021960068616; Wed, 17 Jul 2019 04:54:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1468580F7C; Wed, 17 Jul 2019 11:54:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE47C5C28C; Wed, 17 Jul 2019 11:54:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 985343CBB; Wed, 17 Jul 2019 11:54:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsMbf031431 for ; Wed, 17 Jul 2019 07:54:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87FAD10A394B; Wed, 17 Jul 2019 11:54:22 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 125E11091EFD for ; Wed, 17 Jul 2019 11:54:21 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:00 +0200 Message-Id: <20190717115409.1452-12-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 11/20] quayadmin: Add support for the PUT method X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 17 Jul 2019 11:54:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We're going to need it for some specific Quay APIs later on. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 4e60653..9f1b7d4 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -87,6 +87,10 @@ def post(config, endpoint, payload=3DNone, debug=3DFalse= ): return request(config, endpoint, method=3Drequests.post, payload=3Dpay= load, debug=3Ddebug) =20 =20 +def put(config, endpoint, payload=3DNone, debug=3DFalse): + return request(config, endpoint, method=3Drequests.put, payload=3Dpayl= oad, debug=3Ddebug) + + def has_error(quiet, res, expected, message): if res.status_code =3D=3D expected: return False --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364469; cv=none; d=zoho.com; s=zohoarc; b=ELueH57hPlGKbferEfugUj9vlcSdyZ1XnRQysW+mC7BH1gdfFiYN3hgcWPwVzVEQ8gY5XZ8Q2hJCTgw0lFeiEEaWugbnGu/Fbgyv3kLEu1QtOSeyLt+YUpAasKIESAoLQesOYfmy72QsxcphjFIU1eRLH4xWDHCCAndVVvJJR4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364469; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Gzl1hKlrSmXzkz6IUfA4JAt9NVoLripc8vygvEKXRJI=; b=QWsIs0cfHjo4WYgkoSpJ/ZKurpUfa9/sO9XNuRn3miIrl2G9N9feFmTazHFcqQA0+sfE42/Pr8VjMq43jtoWQ7798OSgN/EpFZ+sbqIU2HwkMlwvFU7mcZupps/bLf6AZqgbnm04pe+WJTIROwEaEV1AGy9kNnmQmViqQEtbdn0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364469375573.0692530116247; Wed, 17 Jul 2019 04:54:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4CB418665F; Wed, 17 Jul 2019 11:54:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2AD881017E3B; Wed, 17 Jul 2019 11:54:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E0D2C1800209; Wed, 17 Jul 2019 11:54:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsNNs031445 for ; Wed, 17 Jul 2019 07:54:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 57D7A10A394C; Wed, 17 Jul 2019 11:54:23 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D555F10A394B for ; Wed, 17 Jul 2019 11:54:22 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:01 +0200 Message-Id: <20190717115409.1452-13-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 12/20] quayadmin: Add list-triggers command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 17 Jul 2019 11:54:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- guests/quayadmin | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 9f1b7d4..af324a7 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -173,6 +173,22 @@ def run_delete_repo(config, args): print("Repository {}/{} deleted".format(args.namespace, args.repo)) =20 =20 +def run_list_triggers(config, args): + endpoint =3D "/repository/{}/{}/trigger".format(args.namespace, args.r= epo) + + res =3D get(config, endpoint, debug=3Dargs.debug) + + if has_error(args.quiet, res, 200, + "Cannot list triggers for repository {}/{}" + .format(args.namespace, args.repo)): + return 1 + + info =3D res.json() + + for trigger in info["triggers"]: + print(trigger["id"]) + + def add_arg_namespace(parser): parser.add_argument("namespace", help=3D"Organization or user name") =20 @@ -221,6 +237,15 @@ def build_parser_delete_repo(subparser): add_arg_repo(parser) =20 =20 +def build_parser_list_triggers(subparser): + parser =3D subparser.add_parser("list-triggers", help=3D"List reposito= ry triggers") + + parser.set_defaults(func=3Drun_list_triggers) + + add_arg_namespace(parser) + add_arg_repo(parser) + + def build_parser(): parser =3D argparse.ArgumentParser( description=3D"quay.io client admin tool" @@ -237,6 +262,8 @@ def build_parser(): build_parser_create_repo(subparser) build_parser_delete_repo(subparser) =20 + build_parser_list_triggers(subparser) + return parser =20 def main(): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364485; cv=none; d=zoho.com; s=zohoarc; b=D+pdp18ekG/yojWdxiFpMDEslX44HklTcQxS4v2CayES3DIpqZAM4tsuvkfxQiZJWGGeFUbKm0cToaJC2X7ObN0xngpxN/4e8xLWQo7X3jqT5ZsF92UJ6v+AkghPa9IYdWTYR0G1ibwWj7swyytsZzBVfDih2lt6MqFY3IeNNi4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364485; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=XS+6DAWJzNVAskrlT/oSXUJJATljqyTlq8QMR8fKgKI=; b=ipnkR+d/ig0kYbiaB2UWWixq0HazhkM+9C1WH1CqauCju5PRmCa+Lt+6pDWP/9wr4TMEBL5lrp38OV9qDDhGduDg2UPqJFoFdgRzdbkkQ2oIZpyKYkZFYW6NlpZzDSMcCxdMhc9vkQoqtDFskUDVobNMcG67OqwydygRbn7P1cg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364485750807.3155118095751; Wed, 17 Jul 2019 04:54:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DE845AFE9; Wed, 17 Jul 2019 11:54:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 083F510027BE; Wed, 17 Jul 2019 11:54:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C4318264C9; Wed, 17 Jul 2019 11:54:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsOlv031457 for ; Wed, 17 Jul 2019 07:54:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A7C81001E75; Wed, 17 Jul 2019 11:54:24 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A572F10A394B for ; Wed, 17 Jul 2019 11:54:23 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:02 +0200 Message-Id: <20190717115409.1452-14-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 13/20] quayadmin: Add show-trigger command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 17 Jul 2019 11:54:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- guests/quayadmin | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index af324a7..de88c55 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -189,6 +189,28 @@ def run_list_triggers(config, args): print(trigger["id"]) =20 =20 +def run_show_trigger(config, args): + endpoint =3D "/repository/{}/{}/trigger/{}".format(args.namespace, + args.repo, args.trigg= er) + + res =3D get(config, endpoint, debug=3Dargs.debug) + + if has_error(args.quiet, res, 200, + "Cannot query trigger {} for repository {}/{}" + .format(args.trigger, args.namespace, args.repo)): + return 1 + + info =3D res.json() + + print("trigger:") + print(" namespace: {}".format(args.namespace)) + print(" repo: {}".format(args.repo)) + print(" id: {}".format(args.trigger)) + print(" source_repo: {}".format(info["config"]["build_source"])) + print(" source_path: {}".format(info["config"]["dockerfile_path"])) + print(" activatable: {}".format(info["can_invoke"])) + + def add_arg_namespace(parser): parser.add_argument("namespace", help=3D"Organization or user name") =20 @@ -201,6 +223,10 @@ def add_arg_desc(parser): parser.add_argument("desc", help=3D"Repository description") =20 =20 +def add_arg_trigger(parser): + parser.add_argument("trigger", help=3D"Trigger ID") + + def build_parser_list_repos(subparser): parser =3D subparser.add_parser("list-repos", help=3D"List container r= epositories") =20 @@ -246,6 +272,16 @@ def build_parser_list_triggers(subparser): add_arg_repo(parser) =20 =20 +def build_parser_show_trigger(subparser): + parser =3D subparser.add_parser("show-trigger", help=3D"Show trigger i= nformation") + + parser.set_defaults(func=3Drun_show_trigger) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_trigger(parser) + + def build_parser(): parser =3D argparse.ArgumentParser( description=3D"quay.io client admin tool" @@ -263,6 +299,7 @@ def build_parser(): build_parser_delete_repo(subparser) =20 build_parser_list_triggers(subparser) + build_parser_show_trigger(subparser) =20 return parser =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364475; cv=none; d=zoho.com; s=zohoarc; b=EYTDLz7HUInWdqjPNDPf+jAyJzo8s5ByP1LQWXRTcKJsRn1vBaWHSxu/LBNCvJ9oxUyqOpEbEfPPmA977a8Jn9m6X6AVxLNlBTGq/QdfXWXEj8Bzwk8nAOcEGwc5fvAjEYt/J33bWO97gV7vw5QSeusL3A9CuwJ6kz7b9/G8k/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364475; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sCX+VAspVpT/TduCDWR0PBBS95FRskNDPnHtfLaDUtI=; b=U9wbSgtMel+19lQ0u0n4rjU1jxFf0TxgQJH2AODyav0m6JVLXlVP+7HvwtGb/PIzdiSq+vPoAaiM34vzR1FDzIHZV7h84LQqgJxrGn1MaPi8P8Sf8E5IGmZJ0bJtqqui543Lh4OyVjXXSNecjDVrHWnB+bvXQ52nkzXHls+B8rw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364475299758.3742241006927; Wed, 17 Jul 2019 04:54:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9CC6C3082E23; Wed, 17 Jul 2019 11:54:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7658060C67; Wed, 17 Jul 2019 11:54:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 383D2180020D; Wed, 17 Jul 2019 11:54:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsOS8031464 for ; Wed, 17 Jul 2019 07:54:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id ED7551001E75; Wed, 17 Jul 2019 11:54:24 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 77F8010190A7 for ; Wed, 17 Jul 2019 11:54:24 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:03 +0200 Message-Id: <20190717115409.1452-15-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 14/20] quayadmin: Add activate-trigger command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 17 Jul 2019 11:54:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- guests/quayadmin | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index de88c55..dd612da 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -211,6 +211,28 @@ def run_show_trigger(config, args): print(" activatable: {}".format(info["can_invoke"])) =20 =20 +def run_activate_trigger(config, args): + endpoint =3D "/repository/{}/{}/trigger/{}/start".format(args.namespac= e, + args.repo, + args.trigger) + payload =3D { + "commit_sha": args.commit, + } + + res =3D post(config, endpoint, payload=3Dpayload, debug=3Dargs.debug) + + if has_error(args.quiet, res, 201, + "Cannot activate trigger {} for repository {}/{}" + .format(args.trigger, args.namespace, args.repo)): + return 1 + + info =3D res.json() + + if not args.quiet: + print("Build {} for {}/{} created".format(info["id"], + args.namespace, args.rep= o)) + + def add_arg_namespace(parser): parser.add_argument("namespace", help=3D"Organization or user name") =20 @@ -227,6 +249,10 @@ def add_arg_trigger(parser): parser.add_argument("trigger", help=3D"Trigger ID") =20 =20 +def add_arg_commit(parser): + parser.add_argument("commit", help=3D"Git commit hash") + + def build_parser_list_repos(subparser): parser =3D subparser.add_parser("list-repos", help=3D"List container r= epositories") =20 @@ -282,6 +308,17 @@ def build_parser_show_trigger(subparser): add_arg_trigger(parser) =20 =20 +def build_parser_activate_trigger(subparser): + parser =3D subparser.add_parser("activate-trigger", help=3D"Start buil= d from trigger") + + parser.set_defaults(func=3Drun_activate_trigger) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_trigger(parser) + add_arg_commit(parser) + + def build_parser(): parser =3D argparse.ArgumentParser( description=3D"quay.io client admin tool" @@ -300,6 +337,7 @@ def build_parser(): =20 build_parser_list_triggers(subparser) build_parser_show_trigger(subparser) + build_parser_activate_trigger(subparser) =20 return parser =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364489; cv=none; d=zoho.com; s=zohoarc; b=TBgVdtRzQrOrQ8eoZXivPyIuG//NTB6/xpIy8dmX6f3OeNaRnav6NRzAtVer6X26EPMGu+zTf2TRm4cq7Xqw3gvNGQkZXeZMELPYOTVRDmk3VN4PFWOKDiq8Yacs7MEjcb9w2NfiluFalVpge02uyyni26OTAqXCzEHR/VlpoQc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364489; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pzthY0z+hr2yn44TRp68LF993BGzuPsdQi7SfA5rlas=; b=XebvbgJ/fMnD0/rLvMn5Z3qtVHEz+0WVxaGSRll7nXJoc2mSHU/jYuS9h7dHOLTotbQalZ9vstWZfj01d7LP9PyBQpHuIIX2TfoLkvXl/zHSe3VSNujEi9A/Utb37/diojrSyqDxt+ccJMQrSOI96erFwDXbkK5ycJMDwFLMr9g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364489415610.7373205501699; Wed, 17 Jul 2019 04:54:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2BCC300D1C7; Wed, 17 Jul 2019 11:54:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF5015B68A; Wed, 17 Jul 2019 11:54:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7EA153CBC; Wed, 17 Jul 2019 11:54:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsPBR031469 for ; Wed, 17 Jul 2019 07:54:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id BCDAE1001E75; Wed, 17 Jul 2019 11:54:25 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46AAF10190A7 for ; Wed, 17 Jul 2019 11:54:25 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:04 +0200 Message-Id: <20190717115409.1452-16-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 15/20] quayadmin: Add list-builds command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 17 Jul 2019 11:54:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- guests/quayadmin | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index dd612da..7cc9b5a 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -173,6 +173,22 @@ def run_delete_repo(config, args): print("Repository {}/{} deleted".format(args.namespace, args.repo)) =20 =20 +def run_list_builds(config, args): + endpoint =3D "/repository/{}/{}/build".format(args.namespace, args.rep= o) + + res =3D get(config, endpoint, debug=3Dargs.debug) + + if has_error(args.quiet, res, 200, + "Cannot list builds for repository {}/{}" + .format(args.namespace, args.repo)): + return 1 + + info =3D res.json() + + for build in info["builds"]: + print(build["id"]) + + def run_list_triggers(config, args): endpoint =3D "/repository/{}/{}/trigger".format(args.namespace, args.r= epo) =20 @@ -289,6 +305,15 @@ def build_parser_delete_repo(subparser): add_arg_repo(parser) =20 =20 +def build_parser_list_builds(subparser): + parser =3D subparser.add_parser("list-builds", help=3D"List repository= builds") + + parser.set_defaults(func=3Drun_list_builds) + + add_arg_namespace(parser) + add_arg_repo(parser) + + def build_parser_list_triggers(subparser): parser =3D subparser.add_parser("list-triggers", help=3D"List reposito= ry triggers") =20 @@ -335,6 +360,8 @@ def build_parser(): build_parser_create_repo(subparser) build_parser_delete_repo(subparser) =20 + build_parser_list_builds(subparser) + build_parser_list_triggers(subparser) build_parser_show_trigger(subparser) build_parser_activate_trigger(subparser) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364492; cv=none; d=zoho.com; s=zohoarc; b=T9XoRspRF/CtsGgXcjvo9EV+uxg8S0x1U3w+r6c3wOLU8lRwYPo4QdQ/htE2favpGTz1Sky9vAyiPZKnnNcBZDk062+jgx+VPOlLwyp+3dTk9+ZljirWW5jEVR7NdlrIYbfsEUn+DMJJfLaRvcuyvX2ujgo/SNsbxjuiDNqgaos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364492; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=WVllWaaPCB9ij05s+5tA2fd09epceiUF+2rWRCTgENw=; b=lfC4xeSVg4ZefiT43Qd/mEzDd9/ow57EjP1N7LiciGMiPGtCyFfqTvMCr0dEca2fO79Ywg+kO4AQJ6dcz2WOJ8X/Cv1In6cYeoAoUZlu4woqLRU/dbLf4Lf7N7M/avuPy/ntaCPat3shNKvWt+wErc2Fq8dVCSvENOKKlgfCpJU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364492938429.4997531606422; Wed, 17 Jul 2019 04:54:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 678AF59465; Wed, 17 Jul 2019 11:54:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E5AA19D7E; Wed, 17 Jul 2019 11:54:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F3FDE18045E2; Wed, 17 Jul 2019 11:54:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsQXx031474 for ; Wed, 17 Jul 2019 07:54:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8C0CA1017E3B; Wed, 17 Jul 2019 11:54:26 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 161691001E75 for ; Wed, 17 Jul 2019 11:54:25 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:05 +0200 Message-Id: <20190717115409.1452-17-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 16/20] quayadmin: Add show-build command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 17 Jul 2019 11:54:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- guests/quayadmin | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 7cc9b5a..a537706 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -189,6 +189,27 @@ def run_list_builds(config, args): print(build["id"]) =20 =20 +def run_show_build(config, args): + endpoint =3D "/repository/{}/{}/build/{}".format(args.namespace, + args.repo, args.build) + + res =3D get(config, endpoint, debug=3Dargs.debug) + + if has_error(args.quiet, res, 200, + "Cannot query build {} for repository {}/{}" + .format(args.build, args.namespace, args.repo)): + return 1 + + info =3D res.json() + + print("build:") + print(" namespace: {}".format(args.namespace)) + print(" repo: {}".format(args.repo)) + print(" id: {}".format(args.build)) + print(" phase: {}".format(info["phase"])) + print(" started: {}".format(info["started"])) + + def run_list_triggers(config, args): endpoint =3D "/repository/{}/{}/trigger".format(args.namespace, args.r= epo) =20 @@ -269,6 +290,10 @@ def add_arg_commit(parser): parser.add_argument("commit", help=3D"Git commit hash") =20 =20 +def add_arg_build(parser): + parser.add_argument("build", help=3D"Build ID") + + def build_parser_list_repos(subparser): parser =3D subparser.add_parser("list-repos", help=3D"List container r= epositories") =20 @@ -314,6 +339,16 @@ def build_parser_list_builds(subparser): add_arg_repo(parser) =20 =20 +def build_parser_show_build(subparser): + parser =3D subparser.add_parser("show-build", help=3D"Show build info") + + parser.set_defaults(func=3Drun_show_build) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_build(parser) + + def build_parser_list_triggers(subparser): parser =3D subparser.add_parser("list-triggers", help=3D"List reposito= ry triggers") =20 @@ -361,6 +396,7 @@ def build_parser(): build_parser_delete_repo(subparser) =20 build_parser_list_builds(subparser) + build_parser_show_build(subparser) =20 build_parser_list_triggers(subparser) build_parser_show_trigger(subparser) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364493; cv=none; d=zoho.com; s=zohoarc; b=ncmtnc15E8n/a25JQSbAjzDAX853/9IQcstWrqn1KduVcONueq/NpM3CfjgOkgOO1nQ3eOv3VQWs/xkae77qFTLe15EjuA/6CvPLcc/pS65Tsiv+KgY5NHvx2tYKyFi3DNU/jfnbmJZCObe+kUYAe/onB2UtEByS8XJPaQSERgY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364493; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=txmQWkEiBWr7JhxjflkgOZtf2F5Dkmbc1PlCvrQzSXU=; b=BeOcz2zQYsr1Fue6QVL8jprvxgaVExHf1ZzIR8WAXl5X8+7GdV8SaswIeH+sF2IeUTMc1b4qlHqp0mBaPF1MKhftTwQpgigfAbxx0NX7mTv3XRe8jFvzSWAqMFNl9q/c5WgxRFvFth0y1gLucnavs/JGd1mnmaPqC9K/EdsaAng= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364493901463.0828504897055; Wed, 17 Jul 2019 04:54:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6E93081DE0; Wed, 17 Jul 2019 11:54:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 462195C5BB; Wed, 17 Jul 2019 11:54:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0903518045E3; Wed, 17 Jul 2019 11:54:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsRda031479 for ; Wed, 17 Jul 2019 07:54:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A8E810190A2; Wed, 17 Jul 2019 11:54:27 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D95FA1001E75 for ; Wed, 17 Jul 2019 11:54:26 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:06 +0200 Message-Id: <20190717115409.1452-18-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 17/20] quayadmin: Add list-tags command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 17 Jul 2019 11:54:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The implementation is limited in that it will not work properly if a repository contains more than 100 tags, but that's not really a big concern for us as each repository is only going to contain a single tag (latest). Signed-off-by: Andrea Bolognani --- guests/quayadmin | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index a537706..5481e3f 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -173,6 +173,26 @@ def run_delete_repo(config, args): print("Repository {}/{} deleted".format(args.namespace, args.repo)) =20 =20 +def run_list_tags(config, args): + endpoint =3D "/repository/{}/{}/tag".format(args.namespace, args.repo) + params =3D { + "onlyActiveTags": True, + "limit": 100, + } + + res =3D get(config, endpoint, params=3Dparams, debug=3Dargs.debug) + + if has_error(args.quiet, res, 200, + "Cannot list tags for repository {}/{}" + .format(args.namespace, args.repo)): + return 1 + + info =3D res.json() + + for tag in info["tags"]: + print ("{}".format(tag["name"])) + + def run_list_builds(config, args): endpoint =3D "/repository/{}/{}/build".format(args.namespace, args.rep= o) =20 @@ -330,6 +350,15 @@ def build_parser_delete_repo(subparser): add_arg_repo(parser) =20 =20 +def build_parser_list_tags(subparser): + parser =3D subparser.add_parser("list-tags", help=3D"List repository t= ags") + + parser.set_defaults(func=3Drun_list_tags) + + add_arg_namespace(parser) + add_arg_repo(parser) + + def build_parser_list_builds(subparser): parser =3D subparser.add_parser("list-builds", help=3D"List repository= builds") =20 @@ -395,6 +424,8 @@ def build_parser(): build_parser_create_repo(subparser) build_parser_delete_repo(subparser) =20 + build_parser_list_tags(subparser) + build_parser_list_builds(subparser) build_parser_show_build(subparser) =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364496; cv=none; d=zoho.com; s=zohoarc; b=dwiMM2xPi+G8YPTBE0p5eZk7YbMriDJskA/ZL6FphTMI/2J7EvlreZdTl6Bf1HsI3svYQ41oM0RRYUvV8PIZQZ4jqJO0XzGHPaEjS1f9FvgsPwzIVBwnJBOD2Sl+FulfgcfoUuz/rDrkaisEoiGZP/8QqpkkeIe5gDw7+Y4WiyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364496; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9EopuIzBxVIAepXDgEtoZu1TOulLDm+DlczyZSWSXYc=; b=gYrEvhe3/6JgO7AWj6/d0t1o1gFXVsBtTJ8DX2mLSVG6P812500qwa0uPz47T8OgFTD0xI1FkqeSaRlVx1UFwLG4TK5AcsYxoTFUXp9WfEbTlFUgAwxZ2IviBdsHCYcQu/4e+WSWTGcyaoWkWPugLfUjjjAijXya7LNC9BBjMaE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364496308923.9885187294896; Wed, 17 Jul 2019 04:54:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C489830917AB; Wed, 17 Jul 2019 11:54:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9AC0A1001DEF; Wed, 17 Jul 2019 11:54:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5F57B18045E9; Wed, 17 Jul 2019 11:54:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsSKD031490 for ; Wed, 17 Jul 2019 07:54:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 28BF51017E3B; Wed, 17 Jul 2019 11:54:28 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7B0F1001E75 for ; Wed, 17 Jul 2019 11:54:27 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:07 +0200 Message-Id: <20190717115409.1452-19-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 18/20] quayadmin: Add show-tag command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 17 Jul 2019 11:54:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The implementation is a bit awkward and surprising because the GET /api/v1/repository/{repository}/tag/{tag}/images API does not report the information we're looking form in an easy to consume form. It also suffers from the same limitations as the list-tags command. Signed-off-by: Andrea Bolognani --- guests/quayadmin | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 5481e3f..69282da 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -193,6 +193,40 @@ def run_list_tags(config, args): print ("{}".format(tag["name"])) =20 =20 +def run_show_tag(config, args): + endpoint =3D "/repository/{}/{}/tag".format(args.namespace, args.repo) + params =3D { + "onlyActiveTags": True, + "limit": 100, + } + + res =3D get(config, endpoint, params=3Dparams, debug=3Dargs.debug) + + if has_error(args.quiet, res, 200, + "Cannot list tags for repository {}/{}" + .format(args.namespace, args.repo)): + return 1 + + info =3D res.json() + + image =3D None + for tag in info["tags"]: + if tag["name"] =3D=3D args.tag: + image =3D tag["image_id"] + break + + if image is not None: + print("tag:") + print(" namespace: {}".format(args.namespace)) + print(" repo: {}".format(args.repo)) + print(" id: {}".format(args.tag)) + print(" image: {}".format(image)) + else: + print("Cannot query tag {} for repository {}/{}: Not Found (404)" + .format(args.tag, args.namespace, args.repo)) + return 1 + + def run_list_builds(config, args): endpoint =3D "/repository/{}/{}/build".format(args.namespace, args.rep= o) =20 @@ -314,6 +348,10 @@ def add_arg_build(parser): parser.add_argument("build", help=3D"Build ID") =20 =20 +def add_arg_tag(parser): + parser.add_argument("tag", help=3D"Tag ID") + + def build_parser_list_repos(subparser): parser =3D subparser.add_parser("list-repos", help=3D"List container r= epositories") =20 @@ -359,6 +397,16 @@ def build_parser_list_tags(subparser): add_arg_repo(parser) =20 =20 +def build_parser_show_tag(subparser): + parser =3D subparser.add_parser("show-tag", help=3D"Show tag informati= on") + + parser.set_defaults(func=3Drun_show_tag) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_tag(parser) + + def build_parser_list_builds(subparser): parser =3D subparser.add_parser("list-builds", help=3D"List repository= builds") =20 @@ -425,6 +473,7 @@ def build_parser(): build_parser_delete_repo(subparser) =20 build_parser_list_tags(subparser) + build_parser_show_tag(subparser) =20 build_parser_list_builds(subparser) build_parser_show_build(subparser) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364496; cv=none; d=zoho.com; s=zohoarc; b=Ci15Cfqkt92rftGhc1WZ0ujTaQuwf5OyyOlbSocos+bOGnJpGnHyyNF6P5WkmvgRScy5cGQE3KjJUH85T2GrKOMSSh+IabndetPqS130fHPtfHMZKCsySzoNxM23wO958rQxj4FNgqd7mh3AFWtD0YZO8uleDlcjrRKXfKvZ5ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364496; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aF7xVhMHQcq+cc9Jq6d/RtGKCgzATc53iDr3rYk9Zh0=; b=IfATrH7JWfIG00FMY67FFhC36ky74eMzbG/dCYZfuP8CC/D0lWBVYIDFg6rUqGm5QdvbI0K38tP+WN7IEjskTK9d1IFhJ78b5uFhKcKkM2C9Wo43N2NE60qUjuxzLsPOawKV99RUzCr84unJzfN33IcquLf8X+x9KCFyph7XpUw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1563364496503101.15143158832348; Wed, 17 Jul 2019 04:54:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC500308FC47; Wed, 17 Jul 2019 11:54:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93EE01001DD7; Wed, 17 Jul 2019 11:54:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5BA3D18045E8; Wed, 17 Jul 2019 11:54:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsSwj031502 for ; Wed, 17 Jul 2019 07:54:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB3A41001E75; Wed, 17 Jul 2019 11:54:28 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7637B10190A2 for ; Wed, 17 Jul 2019 11:54:28 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:08 +0200 Message-Id: <20190717115409.1452-20-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 19/20] quayadmin: Add create-tag command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 17 Jul 2019 11:54:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- guests/quayadmin | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 69282da..ad26c75 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -227,6 +227,26 @@ def run_show_tag(config, args): return 1 =20 =20 +def run_create_tag(config, args): + endpoint =3D "/repository/{}/{}/tag/{}".format(args.namespace, args.re= po, + args.tag) + payload =3D { + "image": args.image, + } + + res =3D put(config, endpoint, payload=3Dpayload, debug=3Dargs.debug) + + if has_error(args.quiet, res, 201, + "Cannot create tag {} for repository {}/{}" + .format(args.tag, args.namespace, args.repo)): + return 1 + + if not args.quiet: + print("Tag {} created in repository {}/{}".format(args.tag, + args.namespace, + args.repo)) + + def run_list_builds(config, args): endpoint =3D "/repository/{}/{}/build".format(args.namespace, args.rep= o) =20 @@ -352,6 +372,10 @@ def add_arg_tag(parser): parser.add_argument("tag", help=3D"Tag ID") =20 =20 +def add_arg_image(parser): + parser.add_argument("image", help=3D"Image ID") + + def build_parser_list_repos(subparser): parser =3D subparser.add_parser("list-repos", help=3D"List container r= epositories") =20 @@ -407,6 +431,17 @@ def build_parser_show_tag(subparser): add_arg_tag(parser) =20 =20 +def build_parser_create_tag(subparser): + parser =3D subparser.add_parser("create-tag", help=3D"Create a new tag= ") + + parser.set_defaults(func=3Drun_create_tag) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_tag(parser) + add_arg_image(parser) + + def build_parser_list_builds(subparser): parser =3D subparser.add_parser("list-builds", help=3D"List repository= builds") =20 @@ -474,6 +509,7 @@ def build_parser(): =20 build_parser_list_tags(subparser) build_parser_show_tag(subparser) + build_parser_create_tag(subparser) =20 build_parser_list_builds(subparser) build_parser_show_build(subparser) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 17:46:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1563364499; cv=none; d=zoho.com; s=zohoarc; b=kwhBaLeFYrKnvj5dDgwI7Z0iryysdW7nQpjSrNc3ROYI2gerxoMHLScNdC2Dd69MMq8Z1D5gsBMHMbjaaDba8AOY71/+GBQUBGw6AwDsCtrOAwbuMCIE+IRPnFjgsX2svfeZptE9IGBGVw1VDuhTHLxl5V1vgqNpFygs7A7Tv0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563364499; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9M+t2D6z6Wa2pyNE5gpxAOud1Yjbs2i61exAHaYuy2E=; b=eVoIBBzeWVrX8GFpzcAMphTnitCO5GIo/XL3xR96eI1Hqazp0Kd5r3aeSyVd7yrwvEhlyPeeWTTG8yMN4CNHI9bEibhpyipgxG8BDa0IC7Y4a4uApQ2VW7jsh51s93Vwaj0xYVc9Le5nEiN3n7454+KCBKCexLRfa2r6uGLsCls= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156336449994691.69058788848645; Wed, 17 Jul 2019 04:54:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4ED0A81F31; Wed, 17 Jul 2019 11:54:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 230CA1018A0D; Wed, 17 Jul 2019 11:54:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DD34519733; Wed, 17 Jul 2019 11:54:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HBsW16031531 for ; Wed, 17 Jul 2019 07:54:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 193BD1001E75; Wed, 17 Jul 2019 11:54:32 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95C2D1017E3B for ; Wed, 17 Jul 2019 11:54:29 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 13:54:09 +0200 Message-Id: <20190717115409.1452-21-abologna@redhat.com> In-Reply-To: <20190717115409.1452-1-abologna@redhat.com> References: <20190717115409.1452-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH 20/20] quayadmin: Add delete-tag command X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 17 Jul 2019 11:54:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- guests/quayadmin | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index ad26c75..63af0f9 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -247,6 +247,23 @@ def run_create_tag(config, args): args.repo)) =20 =20 +def run_delete_tag(config, args): + endpoint =3D "/repository/{}/{}/tag/{}".format(args.namespace, args.re= po, + args.tag) + + res =3D delete(config, endpoint, debug=3Dargs.debug) + + if has_error(args.quiet, res, 204, + "Cannot delete tag {} from repository {}/{}" + .format(args.tag, args.namespace, args.repo)): + return 1 + + if not args.quiet: + print("Tag {} deleted from repository {}/{}".format(args.tag, + args.namespace, + args.repo)) + + def run_list_builds(config, args): endpoint =3D "/repository/{}/{}/build".format(args.namespace, args.rep= o) =20 @@ -442,6 +459,16 @@ def build_parser_create_tag(subparser): add_arg_image(parser) =20 =20 +def build_parser_delete_tag(subparser): + parser =3D subparser.add_parser("delete-tag", help=3D"Delete an existi= ng tag") + + parser.set_defaults(func=3Drun_delete_tag) + + add_arg_namespace(parser) + add_arg_repo(parser) + add_arg_tag(parser) + + def build_parser_list_builds(subparser): parser =3D subparser.add_parser("list-builds", help=3D"List repository= builds") =20 @@ -510,6 +537,7 @@ def build_parser(): build_parser_list_tags(subparser) build_parser_show_tag(subparser) build_parser_create_tag(subparser) + build_parser_delete_tag(subparser) =20 build_parser_list_builds(subparser) build_parser_show_build(subparser) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list