variant value is "unknown" on FreeBSD when invoking util.system_info()

Bug #1698077 reported by Hongjiang Zhang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
Fix Released
Medium
Unassigned

Bug Description

When I run "python3 tools/render-cloudcfg config/cloud.cfg.tmpl config/cloud.cfg" on FreeBSD, the cloud.cfg was created for ubuntu instead of FreeBSD. After investigation, I found the root cause is util.system_info().

platform.platform() gets "FreeBSD-11.0-RELEASE-p9-amd64-64bit-ELF" on FreeBSD 11.0. So, the following code does not work as expected.

    if plat.startswith('darwin'):
        info['variant'] = 'darwin'
    elif plat.endswith("bsd"):
        info['variant'] = 'bsd'

Tags: freebsd
do3meli (d-info-e)
tags: added: freebsd
Scott Moser (smoser)
Changed in cloud-init:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Mina Galić (minagalic) wrote :

this seems to be fixed (although i cannot tell since when)

```
Python 3.7.9 (default, Oct 3 2020, 01:29:35)
[Clang 8.0.1 (tags/RELEASE_801/final 366581)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import cloudinit
>>> from cloudinit import util
>>> util.system_info()
{'platform': 'FreeBSD-12.2-RELEASE-amd64-64bit-ELF', 'system': 'FreeBSD', 'release': '12.2-RELEASE', 'python': '3.7.9', 'uname': ['FreeBSD', 'fbsd12-1', '12.2-RELEASE', 'FreeBSD 12.2-RELEASE r366954 GENERIC', 'amd64', 'amd64'], 'dist': ('freebsd', '12.2', ''), 'variant': 'freebsd'}
>>> util.system_info()['variant']
'freebsd'
>>>
```

Changed in cloud-init:
status: Confirmed → Fix Released
Revision history for this message
James Falcon (falcojr) wrote :
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.