Fix incompatibility with older argparse

With older argparse (circa 2.7.4 vintage), using set_defaults
to set a function on the main parser prevents it from ever
calling the functions set on the sub-parser.

We registered this default function so that we could get help
usage with argparse on python 3.x, since it doesn't print
error by default if no sub-parser command is given (but 2.x
does).

To workaround this, we instead check for 'func' attribute
existing on the parsed args. This is a no-op for python 2.x
since it already printed a usage message by default.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
1 file changed
tree: ec5897ac1fef3c3d8299e54b1d26f77e6d776fad
  1. data/
  2. tools/
  3. LICENSE.BSD
  4. LICENSE.GPL2
  5. README