7.3.1 Error: No such option: --verbosity (Possible options: --verbose, --version)

Bug #2016662 reported by Anatoli Babenia
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Confirmed
Undecided
Unassigned

Bug Description

Snapcraft help shows verbosity option

    $ snapcraft -h
    ...
                      --verbosity: Set the verbosity level to 'quiet',
                                    'brief', 'verbose', 'debug' or
                                    'trace'

The option works but fails when legacy implementation is run. To reproduce, run the `snapcraft --verbosity trace` on snaps that are not core-22.

    $ snapcraft --verbosity trace
    2023-04-17 17:36:58.423 Starting Snapcraft 7.3.1
    2023-04-17 17:36:58.423 Logging execution to '/home/anatoli/.local/state/snapcraft/log/snapcraft-20230417-173658.421936.log'
    2023-04-17 17:36:58.423 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'verbosity': 'trace', 'version': False, 'trace': False} filtered=[]
    2023-04-17 17:36:58.423 Using default command: 'pack'
    2023-04-17 17:36:58.423 General parsed sysargs: command='pack' args=[]
    2023-04-17 17:36:58.424 Command parsed sysargs: Namespace(bind_ssh=False, build_for=None, debug=False, destructive_mode=False, directory=None, enable_developer_debug=False, enable_experimental_extensions=False, enable_experimental_target_arch=False, enable_experimental_ua_services=False, enable_manifest=False, http_proxy=None, https_proxy=None, manifest_image_information=None, output=None, provider=None, target_arch=None, ua_token=None, use_lxd=False)
    2023-04-17 17:36:58.425 lifecycle command: 'pack', arguments: Namespace(bind_ssh=False, build_for=None, debug=False, destructive_mode=False, directory=None, enable_developer_debug=False, enable_experimental_extensions=False, enable_experimental_target_arch=False, enable_experimental_ua_services=False, enable_manifest=False, http_proxy=None, https_proxy=None, manifest_image_information=None, output=None, provider=None, target_arch=None, ua_token=None, use_lxd=False)
    2023-04-17 17:36:58.425 command: pack, arguments: Namespace(bind_ssh=False, build_for=None, debug=False, destructive_mode=False, directory=None, enable_developer_debug=False, enable_experimental_extensions=False, enable_experimental_target_arch=False, enable_experimental_ua_services=False, enable_manifest=False, http_proxy=None, https_proxy=None, manifest_image_information=None, output=None, provider=None, target_arch=None, ua_token=None, use_lxd=False)
    2023-04-17 17:36:58.430 run legacy implementation: base is not core22
    Usage: snapcraft [OPTIONS] COMMAND [ARGS]...
    Try 'snapcraft -h' for help.

    Error: No such option: --verbosity (Possible options: --verbose, --version)

This is the line that produces the message https://github.com/snapcore/snapcraft/blob/d8d4ce07716f72f10c67006ee47339893ebf983e/snapcraft/legacy_cli.py#L44
It looks like the arguments are not explicitly passed to legacy CLI, and `click` in legacy uses the same global `sys.argv`, which contains newer options.

The solution could be to whitelist only supported options and transform `--verbosity trace|debug` into `enable_developer_debug` option for legacy code.
https://github.com/snapcore/snapcraft/blob/d8d4ce07716f72f10c67006ee47339893ebf983e/snapcraft_legacy/cli/_runner.py#L95

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

Hi Anatoli!

Thanks for reporting this bug. I can confirm that the `--verbosity` argument is not supported for building core18|20 snaps. I appreciate the suggestions too.

Changed in snapcraft:
status: New → Confirmed
Revision history for this message
Aritra Basu (nevgen) wrote :

@mr-cal is this being worked on or is it something I can take up?

Revision history for this message
Callahan Kovacs (mr-cal) wrote :

Hi @nevgen!

Thanks for reaching out. This may not be a good issue to take on, because we're planning to solve this as part of a larger effort described here: https://github.com/snapcore/snapcraft/issues/4194

Revision history for this message
Aritra Basu (nevgen) wrote :

Ah, that's fair. Thanks for letting me know

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.