[libvirt] [PATCH 1/3] example: Fix argument handling

Philipp Hahn hahn at univention.de
Wed Oct 12 14:54:40 UTC 2011


sys.argv contains the original command line arguments, while args only
contains the arguments not handled by getopt(). Currently this is no
problem since --help is the only command line option passable, which
terminates the process, so the code is never reached. Any option added
in the future will reveal the bug.

Signed-off-by: Philipp Hahn <hahn at univention.de>
---
 examples/domain-events/events-python/event-test.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py
index 76fda2b..9018366 100644
--- a/examples/domain-events/events-python/event-test.py
+++ b/examples/domain-events/events-python/event-test.py
@@ -486,8 +486,8 @@ def main():
             usage()
             sys.exit()
 
-    if len(sys.argv) > 1:
-        uri = sys.argv[1]
+    if len(args) >= 1:
+        uri = args[0]
     else:
         uri = "qemu:///system"
 
-- 
1.7.1




More information about the libvir-list mailing list