question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] release-related grains returning unexpected values on Ubuntu

See original GitHub issue

Description I have two test boxes. One runs Ubuntu Xenial 16.04.6 LTS, and the other is Debian 9 Stretch. Both are running on amd64.

  • For Ubuntu, the major release version is 16.04, and the minor version is 16.04.6.
  • For Debian, the major release version is 9, and the minor version is 9.13.

On Debian the related grains are returned exactly as expected:

    lsb_distrib_codename:
        stretch
    lsb_distrib_description:
        Debian GNU/Linux 9.13 (stretch)
    lsb_distrib_id:
        Debian
    lsb_distrib_os:
        GNU/Linux
    lsb_distrib_release:
        9.13
    oscodename:
        stretch
    osfinger:
        Debian-9
    osfullname:
        Debian
    osmajorrelease:
        9
    osrelease:
        9.13
    osrelease_info:
        - 9
        - 13

On Ubuntu, I would similarly expect:

    lsb_distrib_codename:
        xenial
    lsb_distrib_description:
        Ubuntu 16.04.6 LTS
    lsb_distrib_id:
        Ubuntu
    lsb_distrib_os:
        GNU/Linux
    lsb_distrib_release:
        16.04
    oscodename:
        xenial
    osfinger:
        Ubuntu-16.04
    osfullname:
        Ubuntu
    osmajorrelease:
        16.04
    osrelease:
        16.04.6
    osrelease_info:
        - 16
        - 4
        - 6

Instead we have:

    lsb_distrib_codename:
        xenial
    lsb_distrib_description:
        Ubuntu 16.04.6 LTS
    lsb_distrib_id:
        Ubuntu
    lsb_distrib_release:
        16.04
    oscodename:
        xenial
    osfinger:
        Ubuntu-16.04
    osfullname:
        Ubuntu
    osmajorrelease:
        16
    osrelease:
        16.04
    osrelease_info:
        - 16
        - 4

Setup No setup required - these are built-in grains.

Steps to Reproduce the behavior salt 'somehost' grains.items

Expected behavior

  • 16.04 is returned as the full OS version in both osrelease ond osrelease_info. This is incorrect. It should report 16.04.6.
  • 16 is treated as the major OS version in osmajorrelease. It this incorrect as there is no such release, so it’s quite meaningless. There is only 16.04 and 16.10 major versions, and in this case it should report 16.04.
  • Also, lsb_distrib_os probably should not be missing.

Versions Report On a Debian host:

Salt Version:
           Salt: 2019.2.5
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.5.3
      docker-py: Not Installed
          gitdb: 2.0.0
      gitpython: 2.1.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.24.0
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.8
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.13 (default, Sep 26 2018, 18:42:22)
   python-gnupg: 0.3.9
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.1
        timelib: Not Installed
        Tornado: 4.4.3
            ZMQ: 4.2.1
 
System Versions:
           dist: debian 9.13 
         locale: UTF-8
        machine: x86_64
        release: 4.9.0-12-amd64
         system: Linux
        version: debian 9.13 

On a Ubuntu host:

    Salt Version:
               Salt: 2019.2.5
     
    Dependency Versions:
               cffi: Not Installed
           cherrypy: Not Installed
           dateutil: 2.4.2
          docker-py: Not Installed
              gitdb: Not Installed
          gitpython: Not Installed
              ioflo: Not Installed
             Jinja2: 2.8
            libgit2: Not Installed
            libnacl: Not Installed
           M2Crypto: 0.21.1
               Mako: 1.0.3
       msgpack-pure: Not Installed
     msgpack-python: 0.4.6
       mysql-python: Not Installed
          pycparser: Not Installed
           pycrypto: 2.6.1
       pycryptodome: Not Installed
             pygit2: Not Installed
             Python: 2.7.12 (default, Jul 21 2020, 15:19:50)
       python-gnupg: 0.3.8
             PyYAML: 3.11
              PyZMQ: 15.2.0
               RAET: Not Installed
              smmap: Not Installed
            timelib: Not Installed
            Tornado: 4.2.1
                ZMQ: 4.1.4
     
    System Versions:
               dist: Ubuntu 16.04 xenial
             locale: ascii
            machine: x86_64
            release: 4.4.0-1109-aws
             system: Linux
            version: Ubuntu 16.04 xenial

Additional information The reason why this is annoying is because I want to add official Salt repositories, using grains to populate the URL. eg. http://repo.saltstack.com/py3/{{ grains['os']|lower }}/{{ grains['osmajorrelease'] }}/{{ grains['osarch'] }}/latest This should produce URLs like:

  • http://repo.saltstack.com/py3/debian/9/amd64/latest
  • http://repo.saltstack.com/py3/ubuntu/16.04/amd64/latest

But instead I get invalid URLs on Ubuntu hosts, like http://repo.saltstack.com/py3/ubuntu/16/amd64/latest.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
github-abcdecommented, Jul 23, 2020

I can see where you are going with this. The “major release” versions of Ubuntu consist of (at least according to https://en.wikipedia.org/wiki/Ubuntu_version_history) the first two sets of digits. So for Ubuntu, 16.04 would be the osmajorrelease, and the full osrelease would be 16.04.6.

0reactions
boltronicscommented, Jul 27, 2020

Yep, I did see some Centos-specific tests in there. You can see in my above references to _linux_distribution(): that it is named with the underscore (a last minute change to the PR that addressed that) - indicating that all of my work above was done after the fix for that other issue was already merged, so is not affected by the changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Philip Top, Trevor Hardy, Ryan Mast, Dheepak ...
This Dockerfile will build and install HELICS in Ubuntu 18.04 with Python ... The federate sits and waits for a return value from...
Read more >
feed.xml
I spend most of November fixing outstanding bugs for Xdebug 3.2, so that it is ready to be ... Some were related to...
Read more >
Grafana, Loki, and Tempo will be relicensed to AGPLv3
So it wouldn't surprise me if Grafana's motivation was to solidify their position ... Hire more and more people because bugs are piling...
Read more >
parted: ChangeLog
322 323 tests: t0400 - Work around a mkswap bug by using /dev/zero 324 mkswap gets ... 351 In theory open() could return...
Read more >
Text - Python mailing list
You should file an issue on bugs.python.org so it doesn't get lost (and if it's the ... returns empty value on Archlinux https://bugs.python.org/issue20454 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found