From nobody Sat Apr 27 12:50:18 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=1563371387; cv=none; d=zoho.com; s=zohoarc; b=HnVPL9PBEL2o17Tsb+JOaIplUDTJZ9Xy/DsqafeiBi6/0dAXHr+bifSW/C23fcMd8r9Q8FtnAS8Km17TatEo1mdcZC8nY5vsxL4dAxFHP/G3iYpzMER18Dy026tMfHbN8mo7zCJ4Aksv8k+pRuQRE0mNyffb22Ci01oYsd1qSJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371387; 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=456Lx6pgqyXIaapq7DNH1FdYI4fib+W4+y5fXQh/0jE=; b=SFLa+RVFLyiYS+k6jlgE586uCYHX/UjRa3qsEf3U8zPZYN7SNVKrOLzfpWHdY8Jq9OOT92SX8ZNP7rSnDXh7+AuCh/iaNQICHhjKMWiYc+AYT/9XAQ7WkBk3cVoESKuCL8f12DrrfR/ma4K5ePtNl3+otWySrfWAaV14ijjvTh0= 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 1563371387270162.97281643980136; Wed, 17 Jul 2019 06:49:47 -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 66E7FC1EB1E4; Wed, 17 Jul 2019 13:49:45 +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 3EB105D71A; Wed, 17 Jul 2019 13:49:45 +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 EDD9E18045CE; Wed, 17 Jul 2019 13:49:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnbUo025387 for ; Wed, 17 Jul 2019 09:49:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87EAF60A35; Wed, 17 Jul 2019 13:49:37 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DDE2560BEE for ; Wed, 17 Jul 2019 13:49:36 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:10 +0200 Message-Id: <20190717134929.10540-2-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.32]); Wed, 17 Jul 2019 13:49:45 +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: Daniel P. Berrang=C3=A9 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 Sat Apr 27 12:50:18 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=1563371382; cv=none; d=zoho.com; s=zohoarc; b=PcsxJOy4mcq8nUpz4J2dqiq6XV3P3Fsw+8ZTDB53n0KWBHrfCGbATwwzjcsNTSeXQNnzA04o+D3d5YMBqw0amFLNpkILzTT3+08XVEe9xFqMYDThF7Os5msNeIuBj7KyK0nSNIkt6lQNVGmqhyBjgEvgbIm0QXgChaohLVNJKBc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371382; 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=SBr/U6/gKGRBk83o3tNtMnBYg0360pZqXSo4yHHf+Wpa9pRxKnWZXGxCXpojAdTELAVFOXGklsmZJHb4nGiKfyKVyQn0lFqdpMnJbWqGS3kEkUHzZPREnfOKjqNRz+L2niaV1DJ++FmXHltQGJhVbmDHKKoq1cKKXeaju8x8EXs= 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 1563371382435756.0712122407061; Wed, 17 Jul 2019 06:49:42 -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 76397308A963; Wed, 17 Jul 2019 13:49:40 +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 4C4F419C59; Wed, 17 Jul 2019 13:49: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 0E7C74E58F; Wed, 17 Jul 2019 13:49:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnc5X025396 for ; Wed, 17 Jul 2019 09:49:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 56A6360920; Wed, 17 Jul 2019 13:49:38 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D407A60D7C for ; Wed, 17 Jul 2019 13:49:37 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:11 +0200 Message-Id: <20190717134929.10540-3-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 17 Jul 2019 13:49:41 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- 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 Sat Apr 27 12:50:18 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=1563371387; cv=none; d=zoho.com; s=zohoarc; b=GKNMvK08dpyCidOmmK9RyRhV7N46t1SvSIqeG4mqaTFROeJSXujB6PdUWY22jeZPNVcSulJlZGkutv3IklfvNpCuWT45rliEoJVnLnM79ewTvzCKofcclDIfiaCQJSrsFIna/V3hK7mNTy8Ry69b3yyRp2Z6rrr16zUKsaywkFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371387; 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=r/jebztjB9GppPQcop7K6mj8B6mKXPnarBnrmNQU4jA=; b=doK1gYoFjEhOOLViB6k+TzylDtg9sKeTx/aR8E4HptlsTS2gG2+Nfo2LUVYxcjRoDpKNHcjBPRrPO+pWKdh3+66aqVjreyMgYy4r7Ev8QMfoBsRQ9cQnr0JHugYLaNu7LmF+BumFqD+NRw4kSG17H1E23/rQkTLoy68hCvplobc= 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 1563371387319448.7122336044155; Wed, 17 Jul 2019 06:49:47 -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 68823307154A; Wed, 17 Jul 2019 13:49:45 +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 3ED441001B38; Wed, 17 Jul 2019 13:49:45 +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 EAC321800208; Wed, 17 Jul 2019 13:49:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDndLE025403 for ; Wed, 17 Jul 2019 09:49:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2449760920; Wed, 17 Jul 2019 13:49:39 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A2C3660A35 for ; Wed, 17 Jul 2019 13:49:38 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:12 +0200 Message-Id: <20190717134929.10540-4-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 03/20] quayadmin: Tweak quiet logic 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.49]); Wed, 17 Jul 2019 13:49:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If we've been asked not to produce any output, we can bail early: doing so means we don't need to increase indentation for subsequent code, and in some cases we can even avoid fetching the JSON data from the response object. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 5dc5eff..3e6cc87 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -83,9 +83,12 @@ def run_show_repo(args): .format(args.namespace, args.repo)): return 1 =20 + if args.quiet: + return 0 + 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): @@ -101,8 +104,10 @@ def run_create_repo(args): .format(args.namespace, args.repo)): return 1 =20 - if not args.quiet: - print("Repository {}/{} created".format(args.namespace, args.repo)) + if args.quiet: + return 0 + + print("Repository {}/{} created".format(args.namespace, args.repo)) =20 =20 def run_delete_repo(args): @@ -112,8 +117,10 @@ def run_delete_repo(args): .format(args.namespace, args.repo)): return 1 =20 - if not args.quiet: - print("Repository {}/{} deleted".format(args.namespace, args.repo)) + if args.quiet: + return 0 + + print("Repository {}/{} deleted".format(args.namespace, args.repo)) =20 =20 def add_arg_namespace(parser): --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 12:50:18 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=1563371390; cv=none; d=zoho.com; s=zohoarc; b=XHrNUOCrW37YM3OJocuXtE/b8Va6pT8C3QrGXfj9eQ97qfxQ/FYhsgARV95sTS1X2yhgrrqwXV64t6Kbso1G8qFqrOYdEdHrbxC1F5eUGfzPhV62R2Z0i8FLmzgS4ofpy2k06sy50c83D/iRCSVLDmFEvR/V8zNWF/mVopkrONM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371390; 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=o4z5IAYKVaSExgXW0Cc4avhsIgnaQGiA+QXZnJeiX1s=; b=Jse7yQX7k8bXEgtrC0aU+7S/3hXp6pysfOBw8xL9MRMMwNvnAVegi55atQRVPPTzOp4lE/Pnnw9Fjc4pqgdw/rpEIQMzA+n39e9x7xaSH9IVeclVrm7Gcq7JiMQkSqdfQILZycvENeFerh/zQbaVJ5pCb3OwM2lVp+HfZ3jAXi4= 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 1563371390732524.9171473214504; Wed, 17 Jul 2019 06:49:50 -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 E292E3082E23; Wed, 17 Jul 2019 13:49: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 BC1875D720; Wed, 17 Jul 2019 13:49:48 +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 7CFA94EBC0; Wed, 17 Jul 2019 13:49:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDndcl025409 for ; Wed, 17 Jul 2019 09:49:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id E6F0260A35; Wed, 17 Jul 2019 13:49:39 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7115F60920 for ; Wed, 17 Jul 2019 13:49:39 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:13 +0200 Message-Id: <20190717134929.10540-5-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 17 Jul 2019 13:49:49 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guests/quayadmin b/guests/quayadmin index 3e6cc87..536fbaf 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -88,7 +88,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 Sat Apr 27 12:50:18 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=1563371390; cv=none; d=zoho.com; s=zohoarc; b=W4rdsMAgSXa0hIpH1bwVDPCepgUsg4ElbB5R4zjBImmZAo7hG8CInZSh6maeFhXmfcSz+/RtdzcZ//hgY221meT8rQLJCo1pJWXJ5qnP/e/I823muy1wGak9jWw01pi1+uLUI4yVzJrcx7QQ/jRIxAGvEn4f5ez2flg99iMdab8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371390; 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=UPcGnfPRqPCSUQmQIpPkz4gJQWvUieQcBmZvt2ERdtY=; b=bhJ7cAq7avI6IuOU7MeJkovDz4OIoCo4n4BYTB8NgcUZiy8KRX5+67hOtC/O/DjFnz/Nliq+02Owger3t7cQ2kURRfm1IvYyG9tUIklg3ewnbGmZduIGoY6vDtfCYBPrlMLA91AEZdrei+MAe/sEDEMcJEKpLAh11SNOklZE8og= 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 1563371390513716.0858796439854; Wed, 17 Jul 2019 06:49:50 -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 E412F8665F; Wed, 17 Jul 2019 13:49: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 BD75F19D7B; Wed, 17 Jul 2019 13:49:48 +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 7E7034EBC9; Wed, 17 Jul 2019 13:49:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDneFG025415 for ; Wed, 17 Jul 2019 09:49:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id B7E4660920; Wed, 17 Jul 2019 13:49:40 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4117560A35 for ; Wed, 17 Jul 2019 13:49:40 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:14 +0200 Message-Id: <20190717134929.10540-6-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.26]); Wed, 17 Jul 2019 13:49:49 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guests/quayadmin b/guests/quayadmin index 536fbaf..6eeacd1 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 Sat Apr 27 12:50:18 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=1563371386; cv=none; d=zoho.com; s=zohoarc; b=WGySkiolnX1M6o7yTPI9MlZl0ZtawBm5zOId8bO2ML2lyK1h+GEI1OxngxVg74iVN3arbgqpOUMUyX4+aKQNPXrbHxoffTazZ4Qjwp671AvzfiCPkgrN25oTOUNGX0M9fq9uMs0rmMxMjLz6FdLbdYLQc6/tSAeVH5+0BiH5WTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371386; 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=Nom1h6Z2pGAWRbWzoMPNBX73XosPbtXxPvM7WlR1sY8=; b=jmWwO1S3CzCO7Plwsbs1duyLvrewmSI6fQ+NfCpWxojbwZCTr5SKMD3bvLzK4vH54sjj3t0iejsQmsv10oIxQ7pDYjjYItVnC99AsLtsZnejaiPgOtJeTG8UU+wjIMb0nzccOICERxVAZNhP6XLWhq60tLwX6w8voy7fwasH+yY= 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 1563371386493805.2631806284419; Wed, 17 Jul 2019 06:49:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9ED8E30833A5; Wed, 17 Jul 2019 13:49: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 3ADCD600C8; Wed, 17 Jul 2019 13:49: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 E5E574EA31; Wed, 17 Jul 2019 13:49:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnffV025426 for ; Wed, 17 Jul 2019 09:49:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86B3B60920; Wed, 17 Jul 2019 13:49:41 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 10A7460D7C for ; Wed, 17 Jul 2019 13:49:40 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:15 +0200 Message-Id: <20190717134929.10540-7-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 17 Jul 2019 13:49:45 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 6eeacd1..7ddf7a4 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)): @@ -95,13 +103,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)): @@ -114,7 +125,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 Sat Apr 27 12:50:18 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=1563371390; cv=none; d=zoho.com; s=zohoarc; b=fZslsLpv7dUAaTBKYjfDre4fI+DPFgdJuCGHzYIEmZyLk8LBvhScYb7ep6nxVG/mrQTO/RpfEadWm/Wthcg3R0jrq5pd1lKe8NV13eK4FMY8ydcj3xnRAGEuWvkqpRWQ+DO5ANOMAwAjwl5vZxs8Qo/QLpLn797q3qvZmZ7j4FQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371390; 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=m5qvy5dXjNCMPeRB7QTw/FxvhxfeY572kPNiRJIq+6E=; b=hvd/jHR3xMP9dboJNon0rI41t6m5pp6BDat+7FToge15KzUhxfLBeqy4ce+Q4a9/9rSNYWU70lCLf18lgc8waxzQfFZwBrZa1IhJIUrnfN57SToLaW7y43cIynZGpspp2NuWmE5A+jWAULa8ZCR5qKm23s64ctXqBqsJ+ZKJPkA= 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 1563371390876320.12810482685165; Wed, 17 Jul 2019 06:49:50 -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 02BDB19CBED; Wed, 17 Jul 2019 13:49:49 +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 CD4001001DDE; Wed, 17 Jul 2019 13:49:48 +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 8AA321800206; Wed, 17 Jul 2019 13:49:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDniqH025445 for ; Wed, 17 Jul 2019 09:49:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 537B960A35; Wed, 17 Jul 2019 13:49:44 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D176B60920 for ; Wed, 17 Jul 2019 13:49:41 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:16 +0200 Message-Id: <20190717134929.10540-8-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.29]); Wed, 17 Jul 2019 13:49:49 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 7ddf7a4..04a8b66 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)): @@ -112,7 +129,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)): @@ -127,7 +144,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 Sat Apr 27 12:50:18 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=1563371393; cv=none; d=zoho.com; s=zohoarc; b=axSnsFKQ0wi05Dm+1achNz50IGIJLOpmysIhO24UkRbRwnkJ0IKNTWKudr7TS1UMVI5T2COrccH+g0z8K98RWQwpii0pl4czMAs+qatdOQtgBNKy7gRnP0RDM7ZYWRoTP4BtfzBdhqtBN4JEiLwxiyFAzzNOQSLIEHk7vbtnKFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371393; 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=h9bsHwSnBYy79UHXvfX9IESrb5ZMrYQoPT13kOxR5ts=; b=klMTw2t5Srix59UM1onfeDwKjV1jVn3QZjrhcBELtvgma5mZStNOki+tGP2aQ7uy+CoMj0ow0kVEJd8UuMPxuTpFiKfhN+0OMRfbsnKtymBb8DAtpf6h+2Jo6leejVsxVxEzLTpF1fZ9HbA0HHYYsuL97quhOL7O66yt8pgL5gE= 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 1563371393973617.810788934374; Wed, 17 Jul 2019 06:49:53 -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 3685180F91; Wed, 17 Jul 2019 13:49:52 +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 0D75F5DA34; Wed, 17 Jul 2019 13:49:52 +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 C83B53CB9; Wed, 17 Jul 2019 13:49:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnlLB025469 for ; Wed, 17 Jul 2019 09:49:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 29908437F; Wed, 17 Jul 2019 13:49:47 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A67CD60D7C for ; Wed, 17 Jul 2019 13:49:44 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:17 +0200 Message-Id: <20190717134929.10540-9-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 17 Jul 2019 13:49:52 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 2 -- 1 file changed, 2 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 04a8b66..218a945 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 Sat Apr 27 12:50:18 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=1563371394; cv=none; d=zoho.com; s=zohoarc; b=jD3BvQpXmFWdvDWiDvwckMu9v3weo0f6CcPxJd87+tiSx3jxvbxWnkqow0cSJY2BVP8HpUyLxqdLqBA1+ApaX2NQgkQhU2FdBn3R8MG59qGTvNBcCiHdyHfMUS97/9wcsXVJH98r7rUJgbVRu7+l+IU2I+yq+/FEj1FAsq9uWmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371394; 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=dwVDgMWW7gRhtMc1E5VCL7jxpZW75VDX59+D0a4CKhg=; b=i7t8B0nzcXj94DXPASq6Cyp+BvCdCyo60XRqgl7/TX13FwrSr46552aBchiHcp5TONb8bDwpFWWLJyd9o22fsvMXH4f5dCmZF0mrl5Q9DiqXrMbhGuTYuaytqkcx50sakDIEOB1Mv7BKZDbdbq+tWEi33sGAwYtiLuxWprJ67YI= 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 1563371394314422.94246671282315; Wed, 17 Jul 2019 06:49:54 -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 5D80830860BB; Wed, 17 Jul 2019 13:49:52 +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 3094B60C44; Wed, 17 Jul 2019 13:49:52 +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 E762218045DB; Wed, 17 Jul 2019 13:49:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnl2I025479 for ; Wed, 17 Jul 2019 09:49:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECCD760A35; Wed, 17 Jul 2019 13:49:47 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 768C0437F for ; Wed, 17 Jul 2019 13:49:47 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:18 +0200 Message-Id: <20190717134929.10540-10-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 09/20] quayadmin: 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.44]); Wed, 17 Jul 2019 13:49:53 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 218a945..67873aa 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)): @@ -117,7 +122,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", @@ -127,7 +132,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)): @@ -139,10 +144,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)): @@ -225,7 +230,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 Sat Apr 27 12:50:18 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=1563371397; cv=none; d=zoho.com; s=zohoarc; b=aiEEx1WbWlE4nAQa4b0AfqzA/PEqXN4hTBsBtq8cbZ52WclMwiF06NKrLme8RkueCw46wwCxohvBPhwodYp8oE99y02XhB8RHz6VNNx0n6uTcl51wInySf2uMCp0h4nJMRN/sk/aZJU9G8LqXQK4HU2jytcwabM2Qyahn2cRpW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371397; 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=oWnpHadVe5jizlzJrtKql0Qx7xPs3h8Ed+zz6zQsDT0=; b=MRXIwL7HpxXkmdQ2Ylh3dTGm7zqzV5yY+uVl9gwMLWfQfkyvjNUqnOLFZl9l5gTziAfxizbGvQ0MFUGufpi8r8DQ1Eo33L6SghRKFNFvJabjuSTOkcCwCUEyFJwA/2zyIlRPXlB9C5lgtXOjMcOS9f9LaEONOaW++cLSXi7Fc3o= 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 1563371397683167.35319341914135; Wed, 17 Jul 2019 06:49:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20EDC3082134; Wed, 17 Jul 2019 13:49:56 +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 D465F6013C; Wed, 17 Jul 2019 13:49:55 +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 8A4B618045DE; Wed, 17 Jul 2019 13:49:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnr2l025502 for ; Wed, 17 Jul 2019 09:49:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4537860920; Wed, 17 Jul 2019 13:49:53 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C196860D7C for ; Wed, 17 Jul 2019 13:49:48 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:19 +0200 Message-Id: <20190717134929.10540-11-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 17 Jul 2019 13:49:56 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/guests/quayadmin b/guests/quayadmin index 67873aa..5db7895 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 Sat Apr 27 12:50:18 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=1563371400; cv=none; d=zoho.com; s=zohoarc; b=TxN9mqx+tcGi2JP4d1SA9pP5KDF5ZB5F1dIeDlw87RkPM0PfMZMlj03VBkEKCn4w7IhNlOq0j//0P0IMO+HLg/9CaE4PggkHgxFCqBQhaIoVSFZsRSyEiPH7ki6MitC7ryMFlz07VkD6yYOZFgGyF5WU0kFP54zoz2+b4OWmdeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371400; 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=s0EFxhjb2hRgN5+i/24oLIFZSULi8Seryc6Ku9Z0DbM=; b=B2vPErtctBhrngZ7TgRoUIkVB1aXP5YigqHuhta1tU86a3QG9k97+7BShk3wAGBItWMMRPdy/gAvGjENIjTHncxQaMyKd1hbZg+Atpe5gFXoPB3cEgjwAyloAT0ODQ2IViip/i79pKMlq7WsdzCAp9fcflvCaggg+77vICa1q88= 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 1563371400813523.629020178004; Wed, 17 Jul 2019 06:50:00 -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 5C6B458E23; Wed, 17 Jul 2019 13:49:59 +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 3423E60C78; Wed, 17 Jul 2019 13:49:59 +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 EF078264C9; Wed, 17 Jul 2019 13:49:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnuff025530 for ; Wed, 17 Jul 2019 09:49:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3B87260A35; Wed, 17 Jul 2019 13:49:56 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B944360D7C for ; Wed, 17 Jul 2019 13:49:53 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:20 +0200 Message-Id: <20190717134929.10540-12-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 17 Jul 2019 13:49:59 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 5db7895..bbb35a2 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 Sat Apr 27 12:50:18 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=1563371402; cv=none; d=zoho.com; s=zohoarc; b=ISwVKV/psPS9eKEHrUC9+FpV2Yb1lcNrxjjVhiDIRa6bCTGMjE+ny3+2HHrs4k3K391YYOQIK0cvNkBFh3dg9gIDBzxIUsTTfVkkynIqAZHEwz8B49zGP95JqDkMWQp1wO6czodbkkfjQMblvTP5orZh2NiEP9iYNLSkSQaNibg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371402; 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=08YTsBOYkGlaY+ROhQzSyMIOvjscqLhLuyJuvgwNyQo=; b=dFKO+jpnseXaeuRkqIhGURvN7c2f7LMukdVRQdrnGjDRi0P9/yBznT14BimJ4Yvo5nolrBGIAO7jwAgGu0s2c73SwqdAELvFcOuoxyhuG4DmtjvtUHsP+kGEoRLnECTpVlUUUNSKmPls33mpJqjbZSY4/li4nXoQnRHypo+BVtw= 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 1563371402872723.0164983438871; Wed, 17 Jul 2019 06:50:02 -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 D766330860B6; Wed, 17 Jul 2019 13:50:00 +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 AE8B55E7AA; Wed, 17 Jul 2019 13:50:00 +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 70FE13CBC; Wed, 17 Jul 2019 13:50:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDnxnG025563 for ; Wed, 17 Jul 2019 09:49:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 205C017CDB; Wed, 17 Jul 2019 13:49:59 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EEA517988 for ; Wed, 17 Jul 2019 13:49:56 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:21 +0200 Message-Id: <20190717134929.10540-13-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.44]); Wed, 17 Jul 2019 13:50:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index bbb35a2..99c7a27 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -180,6 +180,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 @@ -228,6 +244,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" @@ -244,6 +269,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 Sat Apr 27 12:50:18 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=1563371407; cv=none; d=zoho.com; s=zohoarc; b=AMhggBD/HAW3T9pCL2As9MngsoLacewnFgv+27jJ9eVTeNGgW/amRSbZkbEgd7lzeJ7JYeAptdWONWYVgcSDUGXQuH7BVc01wq5+fbr46nwKeuStOk9pozbSWoi9u/rlRisEUmcEXQkrVKGQ0CvScLFK9MJrsQF0V6W3YoR5WjQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371407; 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=U66WHpHcAogLNUcodk9og59Ug4MPeypV7s3m2j1qgAs=; b=EKD0SAW/42zzXOXCzc+2Fb7WsktFykbwjLg067qwSRjQRVzTq2BO00zw3TWiZU+G5KwGGXIyOeXESRUkrha5VVYxPz3nmxHg5e5U1gyg50H2cdOAefF09p+1mJixkeITjLtf1f5Dz/sgI0hiq+DJOoIPb7mmHBNfdfaDQkC2PH0= 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 1563371407919695.0183572987218; Wed, 17 Jul 2019 06:50:07 -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 0B4A286671; Wed, 17 Jul 2019 13:50:06 +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 C38341824A; Wed, 17 Jul 2019 13:50:05 +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 5DA3F1972D; Wed, 17 Jul 2019 13:50:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDo3Fh025605 for ; Wed, 17 Jul 2019 09:50:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1582614C4; Wed, 17 Jul 2019 13:50:03 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56FA21798D for ; Wed, 17 Jul 2019 13:49:59 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:22 +0200 Message-Id: <20190717134929.10540-14-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.26]); Wed, 17 Jul 2019 13:50:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 99c7a27..cd989b3 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -196,6 +196,31 @@ 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 + + if args.quiet: + return 0 + + 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 @@ -208,6 +233,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 @@ -253,6 +282,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" @@ -270,6 +309,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 Sat Apr 27 12:50:18 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=1563371417; cv=none; d=zoho.com; s=zohoarc; b=JaaaraDPXq9yHVJ2bzhLE/MaMNd9N5t4xaSdG8dca0hph1pJU5Whbkk2BxCasZgNJHXyLKuDr+6lSl6TUSHr5qpU+oN1Rr4kgRZgP2whlq10M3FmtsPNQCUbLsnIIJfGbFLsjqceODHop2b27TBTiQj2r/WfxdqvVvLHoFb/SfI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371417; 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=uO3p1X3a7D2cpZi3eA9vEpBrmqK+1/FbI87gCVDmwkU=; b=MJdbuHMwEPMij0hsv3p/XmWt/CR+pKYZAnbWlQEubRLBnOvn26xAdzuE29iVZrBHcjOn6JgAkCD+joxBcQjFn0AZN3g5MWIrfW3TQWxS62XV6UAeXgTWPx2eF5mCj4TXP/EhkwliK1PSIQpwm3+uudwQcS0sl+N5j5NnLdayLB8= 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 1563371417592307.50467524977034; Wed, 17 Jul 2019 06:50:17 -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 A418330ADC7E; Wed, 17 Jul 2019 13:50:15 +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 767955E7C0; Wed, 17 Jul 2019 13:50:15 +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 2669C18045E0; Wed, 17 Jul 2019 13:50:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDoD0f025699 for ; Wed, 17 Jul 2019 09:50:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id A93DE17F22; Wed, 17 Jul 2019 13:50:13 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31DBE614CD for ; Wed, 17 Jul 2019 13:50:03 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:23 +0200 Message-Id: <20190717134929.10540-15-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 17 Jul 2019 13:50:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index cd989b3..465cd8d 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -221,6 +221,30 @@ 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 + + if args.quiet: + return 0 + + info =3D res.json() + + print("Build {} for {}/{} created".format(info["id"], + args.namespace, args.repo)) + + def add_arg_namespace(parser): parser.add_argument("namespace", help=3D"Organization or user name") =20 @@ -237,6 +261,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 @@ -292,6 +320,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" @@ -310,6 +349,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 Sat Apr 27 12:50:18 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=1563371429; cv=none; d=zoho.com; s=zohoarc; b=UXYmBw3R9aH7SOmFk15g7JtYwK40xQlzt5oxXsjUmdO/f/rsoeeN/psF6gVT8IqCPPTY4PM/E723HqEqhMAkE8AsP35e1+kJIQhwhuNWJSo4JB50ryPWZGqmagfL32zEb2fSLvGkrlsB37ZpQ/912sJHvLwaH2ijjIouscmz/lc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371429; 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=Fim04ZESdQ1xrWd7arZcdyEna5lAZm/eHPWOm9Aky/o=; b=KSezWOarmA/9kS/9DFW/KZfdk2D50qiw1baHhzgN9UC+GFT6NwrqU2e2bQLrQfybBjgp6fhn2p9CDYJLwNWtEafsIsCjmQRyCJz85OX/WDQdke2gyl7WV3UiavWQBAe4tf7SIWemF9EAr4vxbw9KtFINJevxXZizg2ruR5Pk1yM= 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 1563371429779647.8783165310151; Wed, 17 Jul 2019 06:50:29 -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 25FEA308FBAC; Wed, 17 Jul 2019 13:50:28 +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 EE9D1614C3; Wed, 17 Jul 2019 13:50: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 A6AC41800206; Wed, 17 Jul 2019 13:50:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDoPcr025847 for ; Wed, 17 Jul 2019 09:50:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id E790717A75; Wed, 17 Jul 2019 13:50:25 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6DA02614C3 for ; Wed, 17 Jul 2019 13:50:13 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:24 +0200 Message-Id: <20190717134929.10540-16-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 17 Jul 2019 13:50:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index 465cd8d..c2ea2b7 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -180,6 +180,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 @@ -301,6 +317,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 @@ -347,6 +372,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 Sat Apr 27 12:50:18 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=1563371463; cv=none; d=zoho.com; s=zohoarc; b=Nddg+G6DvQPNsozYJDp1WPDK1sfkqbzaGq8TDdU2QY/N7YZy7654IVstJGT1VRy/4LKFg/vwgxFmCcQOyUZHnHgHlba2Ua5ZBxpZBy+Qb88lMKqGT9fgpU8TlVQWt1y8CYT3rnM0SEt2mpJw5QST18MOpQgmseyOUfdLWoa4ac4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371463; 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=leG7LpFf6fwacDNwIct44YwxSVor7DTYV34rV8FbE4U=; b=FAsdW+JHkVlBZWEfpc9sJaS9YBU30r1zTJ6Hg9OhuDCVaSyXwDv5g9D9a97hwJNqPiO3rHfvyTgV3V6NgL3QSCArr5JDGsFnmivWI02W/rdSRyVogN5QUut3U0qCaeG74hSGTQzpU/URWGXXpeCwBqSF6SHZxKH5hnpLwK2yCzU= 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 1563371463167883.399297405203; Wed, 17 Jul 2019 06:51:03 -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 D93303D95A; Wed, 17 Jul 2019 13:51:00 +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 B37E95B687; Wed, 17 Jul 2019 13:51:00 +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 7AB5F19731; Wed, 17 Jul 2019 13:51:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDoxpN026022 for ; Wed, 17 Jul 2019 09:50:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 804B36403C; Wed, 17 Jul 2019 13:50:58 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A50FE17AC5 for ; Wed, 17 Jul 2019 13:50:26 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:25 +0200 Message-Id: <20190717134929.10540-17-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.30]); Wed, 17 Jul 2019 13:51:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index c2ea2b7..f71ad2d 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -196,6 +196,30 @@ 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 + + if args.quiet: + return 0 + + 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 @@ -281,6 +305,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 @@ -326,6 +354,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 @@ -373,6 +411,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 Sat Apr 27 12:50:18 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=1563371469; cv=none; d=zoho.com; s=zohoarc; b=BJrO3OhhU+P/Y4yqZHdVQvKvviPEYriOUiRQZ+WNqO0utm0rRnQQ4D27ENW331l969OerN3Ul8uBBcojdRINENhm+WD5C8miHO8iPfGz6dir4no2MBJSyXPO7KVBFhsQvUrnfIlsKMky/9skIZBU6RN3RwWtkfh0apknOcreJpQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371469; 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=BqvrhIVY0KyKCLm8oNPMzxyqUQsoPS6wHzr5P15+6UM=; b=Z/eyqcv5OqMsfEzscDO4G40YgQxHhr3UbgLeljij/WLsvOuYG0an50ensjOxOIwwlI4HVua4fJ8w9qeYmdq7Zm0T084dBXOzcZGxeEzOufpOUBVNi2d22RYb4WRhkppscH4tPXbrRgfRuQygxPztAMW7yvnO+eyHgS038m0+nmY= 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 1563371469156712.0134784941423; Wed, 17 Jul 2019 06:51:09 -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 55C3219CFF2; Wed, 17 Jul 2019 13:51:07 +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 E898464028; Wed, 17 Jul 2019 13:51:05 +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 907531972F; Wed, 17 Jul 2019 13:51:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDp3GD026040 for ; Wed, 17 Jul 2019 09:51:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id A876B643EE; Wed, 17 Jul 2019 13:51:02 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F080C18EC7 for ; Wed, 17 Jul 2019 13:50:58 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:26 +0200 Message-Id: <20190717134929.10540-18-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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 13:51:08 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index f71ad2d..aa897f9 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -180,6 +180,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 @@ -345,6 +365,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 @@ -410,6 +439,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 Sat Apr 27 12:50:18 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=1563371469; cv=none; d=zoho.com; s=zohoarc; b=WPzzWnhGpvJc4GU+KPOppQcC6BlGsNErreW4orhRZ8jm8kpfYkq2oMnu7LvYJBLCdBxSmkWPQEGlQELh79x2hhXZMSzusVqsaOf+Yz26NfCwMRqfav5gM/FPehkjakCfIxYwLTkzEPzH9zyhGP/3VhkjI/6Ojhz4XBblWvL+0fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371469; 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=RY5kzTg6DS+TsypLng1yMNTAvdtFoi9+3KoQsywl5DE=; b=XU/VW+jLgZ5a5NHaA99RtssDuQsIpKW10+hxQqPp5GDDHM3D8AhxVRRrSpU4oOzszhdIpB4MHuEmk1dIQt8ZL1r8rd3oEAwEaJ78CcCUiqOFkqFN6dgaII5Th8B0rDDzG3oPVRYqOEXn7fwz1Eq9KDH88poki1S9cnuLSXUqrBM= 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 1563371469230632.3353844694448; Wed, 17 Jul 2019 06:51:09 -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 EA913A3B48; Wed, 17 Jul 2019 13:51:06 +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 7233E646DC; Wed, 17 Jul 2019 13:51:05 +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 1EE9F1972E; Wed, 17 Jul 2019 13:51:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDp3sH026052 for ; Wed, 17 Jul 2019 09:51:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C36F18FDD; Wed, 17 Jul 2019 13:51:03 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB4276402F for ; Wed, 17 Jul 2019 13:51:01 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:27 +0200 Message-Id: <20190717134929.10540-19-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.30]); Wed, 17 Jul 2019 13:51:07 +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 Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index aa897f9..f99ac03 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -200,6 +200,43 @@ 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 None: + print("Cannot query tag {} for repository {}/{}: Not Found (404)" + .format(args.tag, args.namespace, args.repo)) + return 1 + + if args.quiet: + return 0 + + print("tag:") + print(" namespace: {}".format(args.namespace)) + print(" repo: {}".format(args.repo)) + print(" id: {}".format(args.tag)) + print(" image: {}".format(image)) + + def run_list_builds(config, args): endpoint =3D "/repository/{}/{}/build".format(args.namespace, args.rep= o) =20 @@ -329,6 +366,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 @@ -374,6 +415,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 @@ -440,6 +491,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 Sat Apr 27 12:50:18 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=1563371468; cv=none; d=zoho.com; s=zohoarc; b=gxukH5+xJoTlg5Kw7WjY6qpTwj7l4Kolm9DyGy6Nj6gAFNl7yYX/adDN5zpdJMzhR+htgIxTRxlxYypzSEoEePyyYhL95n6wuZBkh3GKvzW2MY8rz/CcXRS1kLSk8pPZs5aA9NJ/Ad2Cu8C8vaAtopF/SIn6hGGK9W8+x2vOpQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371468; 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=b6ywLCRdMJVKQ6TRzH+zQrJ/izwmcuE//nIDk7TzcfQ=; b=DP4rceR94EYRoCnkGR2h0eOCP7Bx9CFzknRWsJnxMqAVcxfOgp+68BsQJq/WPtssjGPp/91mKhGje9BP+D2VVBPWXMyUsQZsdUzLd7Z6nwhzShhBs9uwnkjBb+t92lsgRnTUqKq6g2fDfe4vi3Ye1XkK4HdZZ1dKEmq6sCgvFZw= 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 15633714685961020.0644289127074; Wed, 17 Jul 2019 06:51:08 -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 07DBF335C9; Wed, 17 Jul 2019 13:51:07 +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 AF3C9646CD; Wed, 17 Jul 2019 13:51:05 +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 411031800207; Wed, 17 Jul 2019 13:51:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDp4l0026060 for ; Wed, 17 Jul 2019 09:51:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0EFA1648D2; Wed, 17 Jul 2019 13:51:04 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6AE5614DD for ; Wed, 17 Jul 2019 13:51:02 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:28 +0200 Message-Id: <20190717134929.10540-20-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.38]); Wed, 17 Jul 2019 13:51:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index f99ac03..a35996e 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -237,6 +237,28 @@ def run_show_tag(config, args): print(" image: {}".format(image)) =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 args.quiet: + return 0 + + 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 @@ -370,6 +392,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 @@ -425,6 +451,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 @@ -492,6 +529,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 Sat Apr 27 12:50:18 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=1563371474; cv=none; d=zoho.com; s=zohoarc; b=Kt0GmY6ULIPV8yo6sSRzg8i/hVfkogp9QGagPvIzUz+12FsJGkgJGNwRdJkmCrcu6riTxc8Lqw5KvRdxRDeNFxlqxhlPY42Yvy6GZKpir4EbGKxE3ONfVdjdELTBgM4mWyYMpG3i7VPu4sZtVOOaafU3HwPwYXyeks6xFBkeb8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563371474; 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=I+wXsc26YAl9Htpft8oUK7AXKK36YKTV9xyojJmLjRk=; b=blPHknmLlONob6rKkwbRMbFqj4KQaMPg9OwsHjrTaXWQFalQ8X/4cRQku4SHg6PnQFGI+bOvTkdwuBWBzlNgKP1IcMMGd16K61cyq33tkaTWGrKud20Yp3binT+/TB52ahGcc+J6dYGLcYkR7phBx0KMVK2alGtXqG1LbJ1miqs= 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 1563371474869679.3882773203704; Wed, 17 Jul 2019 06:51:14 -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 DCA013079B93; Wed, 17 Jul 2019 13:51:12 +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 09D45643FA; Wed, 17 Jul 2019 13:51:10 +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 830F31800209; Wed, 17 Jul 2019 13:51:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6HDp8Jg026090 for ; Wed, 17 Jul 2019 09:51:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 325674E6BE; Wed, 17 Jul 2019 13:51:07 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 930EB614D3 for ; Wed, 17 Jul 2019 13:51:03 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 17 Jul 2019 15:49:29 +0200 Message-Id: <20190717134929.10540-21-abologna@redhat.com> In-Reply-To: <20190717134929.10540-1-abologna@redhat.com> References: <20190717134929.10540-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v2 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.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.41]); Wed, 17 Jul 2019 13:51:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- guests/quayadmin | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/guests/quayadmin b/guests/quayadmin index a35996e..36ce183 100755 --- a/guests/quayadmin +++ b/guests/quayadmin @@ -259,6 +259,25 @@ 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 args.quiet: + return 0 + + 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 @@ -462,6 +481,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 @@ -530,6 +559,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