Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-86206

Accept a falsy value for leapp command options defaults

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • leapp-0.19.0-3.el8_10
    • No
    • Moderate
    • rhel-upgrades
    • 12
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      When specifying new command option for leapp using @command_opt decorator, it's possible to specify the default value. However, the value is ignored nowadays if it's falsy (empty string, empty list, ...) - and then it's always `None` instead, like in case the default value is not specified. This is unexpected behaviour and generates additional requirements in the code defining leapp (sub)commands.

      Example of defining default that is ignored now:

      @command('upgrade', help='Upgrade the current system to the next available major version.')
      @command_opt('foo', action='append', default=[],help='Lorem ipsum')
      ... snip ....
      

      Expected behaviour:
      Respect the set default even when wanting empty string or empty list.

              leapp-notifications leapp-notifications
              pstodulk@redhat.com Petr Stodulka
              Petr Stodulka Petr Stodulka
              RHEL Upgrades QE Team RHEL Upgrades QE Team
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: