← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1424277] Re: Running without arguments results in Exception on Python 3

 

** Changed in: cloud-init
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1424277

Title:
  Running without arguments results in Exception on Python 3

Status in cloud-init:
  Fix Released

Bug description:
  I'm trying to run the current trunk on Python 3. When I run cloud-init
  with no arguments, I get the following exception.

      $ python3 bin/cloud-init
      Traceback (most recent call last):
        File "bin/cloud-init", line 623, in <module>
          sys.exit(main())
        File "bin/cloud-init", line 614, in main
          (name, functor) = args.action
      AttributeError: 'Namespace' object has no attribute 'action'

  This is caused by a change of behavior of argparse on Python 3 when
  using subparsers.

  Can be workarounded by adding try-catch similar to this one:

          try:
              (name, functor) = args.action
          except AttributeError:
              parser.print_help()
              return 0

  (Consider it public domain, as it is so simple)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1424277/+subscriptions


References