[jenkins-ci PATCH v2 03/20] quayadmin: Tweak quiet logic

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

 



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 <abologna@xxxxxxxxxx>
---
 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
 
+    if args.quiet:
+        return 0
+
     info = res.json()
-    if not args.quiet:
-        print("{}/{}: {}".format(args.namespace, args.repo, info["description"]))
+
+    print("{}/{}: {}".format(args.namespace, args.repo, info["description"]))
 
 
 def run_create_repo(args):
@@ -101,8 +104,10 @@ def run_create_repo(args):
                  .format(args.namespace, args.repo)):
         return 1
 
-    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))
 
 
 def run_delete_repo(args):
@@ -112,8 +117,10 @@ def run_delete_repo(args):
                  .format(args.namespace, args.repo)):
         return 1
 
-    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))
 
 
 def add_arg_namespace(parser):
-- 
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