Fix 'show version' in current (lithium) dev builds
Closed, ResolvedPublic

Description

I'm running 999.201609160235 (current-branch dev build) on bare hardware--a Netgate RCC-VE appliance. On that box, show version fails as follows:

$ show version
No hypervisor detected
cat: /sys/class/dmi/id/subsystem/id/product_uuid: No such file or directory
Traceback (most recent call last):
  File "/opt/vyatta/bin/vyos-show-version", line 101, in <module>
    version_data['hardware_uuid'] = subprocess.check_output('sudo cat /sys/class/dmi/id/subsystem/id/product_uuid', shell=True).strip()
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command 'sudo cat /sys/class/dmi/id/subsystem/id/product_uuid' returned non-zero exit status 1

It's true that there is no product_uuid file:

$ ls /sys/class/dmi/id/subsystem/id/
bios_date        board_serial       chassis_type     product_name     uevent
bios_vendor      board_vendor       chassis_vendor   product_serial
bios_version     board_version      chassis_version  product_version
board_asset_tag  chassis_asset_tag  modalias         subsystem
board_name       chassis_serial     power            sys_vendor

product_name contains RCC-VE
product_version contains 1.0
and
product_serial is mode 400 and contains a decimal serial number.

The other files contain reasonable-looking values, too.

Perhaps /opt/vyatta/bin/vyos-show-version needs to be a bit more resilient in the face of some missing files.

Details

Difficulty level
Normal (likely a few hours)
Version
999.201609160235 (current-branch dev build)
syncer added a subscriber: VyOS 1.2.x.
dmbaturin closed this task as Resolved.Dec 21 2016, 10:32 PM
dmbaturin claimed this task.
dmbaturin added a subscriber: dmbaturin.

I made it return Unknown if the file in question doesn't exist, hope this fixed the issue.