[katello-devel] Katello-cli and spaces in options

Lukas Zapletal lzap at redhat.com
Tue Jul 26 10:03:41 UTC 2011


Hello,

I just found that for options that allow spaces (e.g. provider name) we 
are not able to provide valid input:

# katello provider import_manifest --org=ACME_Corporation \
   --name "red hat" --file=...
Could not find provider [ red ] within organization [ ACME_Corporation ]

The same for --name="red hat".

We are using optparse [1] which only allow to use one or specific amount 
of options to take using nargs option. This means I can only specify 
particular number of arguments (two in this scenario), but it will 
always require two arguments:

# katello provider import_manifest --org=ACME_Corporation \
   --name "red hat" --file=...
katello: error: --name option requires 2 arguments

The recommended solution is to upgrade to argparse [2] module which 
handles this correctly, and also has more features. There are two 
problems with this:

1) Argparse is only available in Python 2.7+
2) It will take some time to do it :-)

I have filed a bug here:

https://bugzilla.redhat.com/show_bug.cgi?id=725684

For now I will rename my testing default provider to "redhat", but we 
should eventually put this on the backlog. Or if you have a workaround, 
I will be happy to apply it.

[1] http://docs.python.org/library/optparse.html#optparse.Option.nargs
[2] http://docs.python.org/library/argparse.html#nargs

-- 
Later,

  Lukas Zapletal | E32E400A
  RHN Satellite Engineering
  Red Hat Czech s.r.o. Brno




More information about the katello-devel mailing list