]> git-server-git.apps.pok.os.sepia.ceph.com Git - radosgw-agent.git/commitdiff
Fix option parsing for destination arg 3/head
authorChristophe Courtaut <christophe.courtaut@gmail.com>
Tue, 15 Oct 2013 10:09:06 +0000 (12:09 +0200)
committerChristophe Courtaut <christophe.courtaut@gmail.com>
Tue, 15 Oct 2013 10:13:51 +0000 (12:13 +0200)
As mentionned at http://docs.python.org/3.4/library/argparse.html#nargs,
nargs=1 will not provide the default behaviour, but instead will produce
a list of args, and that is not what we want.

This patch uses nargs=None to provide default behaviour instead.

As it is a positionnal argument, we can't use required option.

Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>
radosgw_agent/cli.py

index bf3ed79bc62c9b97306ae1900b315c55913ada95..c1c1f64ff6559bc5a61c5d53ee878c5c5dfbc752 100644 (file)
@@ -81,7 +81,7 @@ def parse_args():
     parser.add_argument(
         'destination',
         type=check_endpoint,
-        nargs=1 if 'destination' not in defaults else '?',
+        nargs=None if 'destination' not in defaults else '?',
         help='radosgw endpoint to which to sync '
         '(e.g. http://zone2.example.org:8080)',
         )