Page MenuHomeVyOS Platform

Show a more descriptive error on trying to use non-existent build types
Open, LowPublic

Description

If the user mistypes a build type name, that leads to a raw unhandled exception:

$ sudo ./build-vyos-image --build-type no-such-type generic
I: Checking if packages required for VyOS image build are installed
I: using build flavors directory data/build-flavors
Traceback (most recent call last):
  File "/vyos/./build-vyos-image", line 295, in <module>
    with open(make_toml_path(defaults.BUILD_TYPES_DIR, pre_build_config["build_type"]), 'rb') as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'data/build-types/no-such-type.toml'

A more user-friendly error could be nice.

Arguably, we should also get rid of sys.exit() calls rather than multiply them: see T8194.

Details

Version
-
Is it a breaking change?
Perfectly compatible
Issue type
Internal change (not visible to end users)

Event Timeline

dmbaturin renamed this task from Show a more descriptive error on trying to use non-existent build types and architectures to Show a more descriptive error on trying to use non-existent build types.Mon, Jan 19, 6:56 PM
dmbaturin updated the task description. (Show Details)