Page MenuHomeVyOS Platform

Raw output for system storage op mode causes exceptions on live CD
Open, LowPublic

Description

Trying to get machine-readable storage data on a live CD results in an unhandled exception:

vyos@vyos:~$ sudo ${vyos_op_scripts_dir}/storage.py show --raw
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/storage.py", line 72, in <module>
    res = vyos.opmode.run(sys.modules[__name__])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/opmode.py", line 263, in run
    res = func(**args)
          ^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/storage.py", line 65, in show
    return _get_raw_data()
           ^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/storage.py", line 48, in _get_raw_data
    out =  _get_system_storage(only_persistent=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/libexec/vyos/op_mode/storage.py", line 40, in _get_system_storage
    res = cmd(cmd_str)
          ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/utils/process.py", line 155, in cmd
    raise OSError(code, feedback)
PermissionError: [Errno 1] failed to run command: df -h -t ext4 --output=source,size,used,avail,pcent
returned: 
exit code: 1

An additional problem is that the raw output is different from the formatted version — the raw version only returns data for persistent storage, while the formatted version prints information about all filesystems, including tmpfs and the like.

I believe the command should not be available on live CD at all, and should always only show persistent FS information.

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

dmbaturin renamed this task from Raw output for system storage op mode doesn to Raw output for system storage op mode causes exceptions on live CD.Jun 24 2024, 12:34 PM
dmbaturin claimed this task.
dmbaturin updated the task description. (Show Details)
dmbaturin changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.
dmbaturin changed Issue type from Unspecified (please specify) to Bug (incorrect behavior).