salt: CloudLinux not detected as os_family: RedHat (consequences of #28951)

Due to the change in #28951, all CloudLinux versions now have the os_family grain of ‘CloudLinux Server’. This is because the _OS_NAME_MAP in grains/core.py:929 was not updated to be consistent with the change. The consequences of this, I’m sure you can imagine, are considerable and terminal to state execution.

Curently: 'cloudserve': 'CloudLinux', This would need changing to: 'cloudlinux: 'CloudLinux',

This then cascades to also break the grains osfinger and osmajorrelease because they rely on os_family. nb. Even setting a manual grain in /etc/salt/grains on the minion for os_family: RedHat does not fix the broken osfinger/osmajorrelease grains, as the test used to set these depends on the value of os_family determined earlier in grains/core.py (this is, perhaps, another problem; that manual grains are not respected during determination of other values)

# salt-minion --versions-report
Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.2.1
       M2Crypto: 0.20.2
           Mako: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.5.0
         Python: 2.6.6 (r266:84292, Jul 29 2015, 18:30:53)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 1.4.1
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: redhat 6.7 Aleksei Gubarev
        machine: x86_64
        release: 2.6.32-673.8.1.lve1.4.3.el6.x86_64
         system: CloudLinux Server 6.7 Aleksei Gubarev

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

@MadsRC We never “gave” it its own os_family. The way this works is that the os grain is checked against a mapping of os grains to os_family names, and if no match is found, as a fallback we use the os grain itself as the os_family. It looks like, way back in 2013, the /etc/redhat-release or /etc/os-release (or whatever it is that we read the OS name from) began with CloudServer or something like that. At some point, this appears to have changed. So, the entry in the _OS_NAME_MAP no longer matches, which means we don’t identify the os grain as CloudLinux, which consequently means there is no match in the _OS_FAMILY_MAP which maps the os grain to its os_family.

I opened https://github.com/saltstack/salt/pull/36408 to properly identify CloudLinux so that it gets the RedHat os_family.

Also, just FYI, I think it is possible to manually set the os and os_family grains using grains.setvals

salt minionname grains.setvals "{'os': 'CloudLinux', 'os_family': 'RedHat'}"

This will add these grains to /etc/salt/grains. I’m not 100 percent certain this solution will work though as I haven’t tested it. In other words, I don’t know if core grains evaluation happens before or after /etc/salt/grains is evaluated.

We don’t often recommend people manually set important grains like this because it can have unexpected consequences, but this is one of the exceptions to the rule.