Skip to content

toolbox create argument 'distro' and 'release' invalid values handling #937

Closed

Description

@oturpe

Describe the bug
toolbox create command accepts parameters --distro and --release.
It is not clear what values should be added to these,
and passing invalid values behaves strangely:

  1. --distro seems to interpret any invalid value to mean Fedora,
    which does not make sense.
    If somebody decided to pass that argument,
    for sure they were expecting to get what they passed in,
    not any fallback because what they wanted is not available
    or because they made a typo.
  2. Except if --distro is used, but --release is not,
    the resulting error message implies different behavior:
    release not found for non-default distribution <distro>.
  3. --release seems to use some kind of pattern matching depending on value of distro,
    and prints invalid argument for --release if the pattern is not matched,
    but does not say what pattern should be matched.

Steps how to reproduce the behaviour

--distro falling back to fedora:

$ toolbox create --distro alpine --release 35
Image required to create toolbox container.
Download registry.fedoraproject.org/fedora-toolbox:13 (500MB)? [y/N]:

--distro without --release implying that it is not going to fall back to Fedora:

$ toolbox create --distro alpine
Error: release not found for non-default distribution alpine

--release not helping with determining the correct pattern:

$ toolbox create --distro rhel --release 8
Error: invalid argument for '--release'
Run 'toolbox --help' for usage.

Expected behaviour
Fedora (nor anything else) is not used as a fallback for invalid --distro value.

Error messages help to fix problems:
Explain the expected pattern for --release
and list supported values for --distro.

Actual behaviour
See above.

Screenshots
n/a

Output of toolbox --version (v0.0.90+)
toolbox version 0.0.92.2

Toolbox package info (rpm -q toolbox)
toolbox-0.0.99.2^3.git075b9a8d2779-4.fc35.x86_64

Output of podman version

Version:      3.4.2
API Version:  3.4.2
Go Version:   go1.16.8
Built:        Fri Nov 12 22:25:37 2021
OS/Arch:      linux/amd64

Podman package info (rpm -q podman)
podman-3.4.2-1.fc35.x86_64

Info about your OS
Fedora Linux 35

Additional context
n/a

Activity

  1. added
    1. Bug
    on Nov 29, 2021
  2. oturpe commented on Nov 29, 2021

    @oturpe
    ContributorAuthor

    Related, it would be good if toolbox create --help would list
    supported values for --distro
    and related patterns for --release.

  3. debarshiray commented on Nov 29, 2021

    @debarshiray
    Member

    --distro seems to interpret any invalid value to mean Fedora,
    which does not make sense.
    If somebody decided to pass that argument,
    for sure they were expecting to get what they passed in,
    not any fallback because what they wanted is not available
    or because they made a typo.

    Yes, you are right. If an invalid value is explicitly specified through the --distro flag, then we should error out with a suitable message.

    --release seems to use some kind of pattern matching depending
    on value of distro, and prints invalid argument for --release if the
    pattern is not matched, but does not say what pattern should be
    matched.

    Yes, this would be good too. :)

  4. added this to the Release 0.1.0 milestone on Dec 5, 2021
  5. self-assigned this
    on Dec 5, 2021
  6. 65 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

1. Bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions