Sandro Bonazzola has uploaded a new change for review.

Change subject: command: allow --help and --version as unprivileged user
......................................................................

command: allow --help and --version as unprivileged user

Change-Id: I79d48d69409494156799ef5a2bd8965ef000e3b5
Bug-Url: https://bugzilla.redhat.com/1059654
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M src/__main__.py
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-log-collector 
refs/changes/52/24452/1

diff --git a/src/__main__.py b/src/__main__.py
index 2ea3eb9..75af400 100755
--- a/src/__main__.py
+++ b/src/__main__.py
@@ -1289,11 +1289,6 @@
     setattr(parser.values, option.dest, value)
 
 if __name__ == '__main__':
-    if os.geteuid() != 0:
-        print "This tool requires root permissions to run."
-        sys.exit(ExitCodes.CRITICAL)
-
-    setup_pg_defaults()
 
     DEFAULT_SCRATCH_DIR = tempfile.mkdtemp(prefix='logcollector-')
 
@@ -1305,6 +1300,11 @@
 
     if len(commandline.intersection(cleanup_set)) != 0:
         atexit.register(cleanup)
+    elif os.geteuid() != 0:
+        print ('This tool requires root permissions to run.')
+        sys.exit(ExitCodes.CRITICAL)
+    else:
+        setup_pg_defaults()
 
     def comma_separated_list(option, opt_str, value, parser):
         setattr(
@@ -1579,6 +1579,7 @@
     parser.add_option_group(engine_group)
     parser.add_option_group(ssh_group)
     parser.add_option_group(db_group)
+    parser.parse_args()
 
     try:
         conf = Configuration(parser)


-- 
To view, visit http://gerrit.ovirt.org/24452
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I79d48d69409494156799ef5a2bd8965ef000e3b5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-log-collector
Gerrit-Branch: ovirt-log-collector-3.4
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to