[libvirt] [jenkins-ci PATCH v2 12/20] quayadmin: Add list-triggers command

Andrea Bolognani posted 20 patches 6 years, 5 months ago
[libvirt] [jenkins-ci PATCH v2 12/20] quayadmin: Add list-triggers command
Posted by Andrea Bolognani 6 years, 5 months ago
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 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))
 
 
+def run_list_triggers(config, args):
+    endpoint = "/repository/{}/{}/trigger".format(args.namespace, args.repo)
+
+    res = get(config, endpoint, debug=args.debug)
+
+    if has_error(args.quiet, res, 200,
+                 "Cannot list triggers for repository {}/{}"
+                 .format(args.namespace, args.repo)):
+        return 1
+
+    info = res.json()
+
+    for trigger in info["triggers"]:
+        print(trigger["id"])
+
+
 def add_arg_namespace(parser):
     parser.add_argument("namespace", help="Organization or user name")
 
@@ -228,6 +244,15 @@ def build_parser_delete_repo(subparser):
     add_arg_repo(parser)
 
 
+def build_parser_list_triggers(subparser):
+    parser = subparser.add_parser("list-triggers", help="List repository triggers")
+
+    parser.set_defaults(func=run_list_triggers)
+
+    add_arg_namespace(parser)
+    add_arg_repo(parser)
+
+
 def build_parser():
     parser = argparse.ArgumentParser(
         description="quay.io client admin tool"
@@ -244,6 +269,8 @@ def build_parser():
     build_parser_create_repo(subparser)
     build_parser_delete_repo(subparser)
 
+    build_parser_list_triggers(subparser)
+
     return parser
 
 def main():
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [jenkins-ci PATCH v2 12/20] quayadmin: Add list-triggers command
Posted by Daniel P. Berrangé 6 years, 5 months ago
On Wed, Jul 17, 2019 at 03:49:21PM +0200, Andrea Bolognani wrote:
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  guests/quayadmin | 27 +++++++++++++++++++++++++++
>  1 file changed, 27 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list