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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 guests/quayadmin | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/guests/quayadmin b/guests/quayadmin
index 9f1b7d4..af324a7 100755
--- a/guests/quayadmin
+++ b/guests/quayadmin
@@ -173,6 +173,22 @@ def run_delete_repo(config, args):
         print("Repository {}/{} deleted".format(args.namespace, args.repo))
 
 
+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")
 
@@ -221,6 +237,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"
@@ -237,6 +262,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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux