Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1559

CoreOS is recognized as Debian in last stable CoreOS version

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: FACT 3.5.0
    • Fix Version/s: FACT 3.6.0
    • Component/s: None
    • Labels:
    • Environment:

      Latest stable CoreOS (1285.6.0), latest puppetlabs/puppet-agent container

    • Template:
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Facter will now report the correct OS name for recent releases of CoreOS.
    • QA Risk Assessment:
      Needs Assessment

      Description

      The following code is used to read /etc/os-release when deciding if the running OS is coreos:

          static unique_ptr<os_linux> get_os()
          {
              auto release_info = os_linux::key_value_file(release_file::os, {"NAME", "CISCO_RELEASE_INFO"});
              auto const& name = release_info["NAME"];
              if (name == "Cumulus Linux") {
                  return unique_ptr<os_linux>(new os_cumulus());
              } else if (name == "CoreOS") {
                  return unique_ptr<os_linux>(new os_coreos());
              } else {
                  auto const& cisco = release_info["CISCO_RELEASE_INFO"];
                  boost::system::error_code ec;
                  if (!cisco.empty() && is_regular_file(cisco, ec)) {
                      return unique_ptr<os_linux>(new os_cisco(cisco));
                  }
              }
              return unique_ptr<os_linux>(new os_linux());
          }
      

      More specifically it uses a straight comparison against the name field.
      In previous version of CoreOS, the /etc/os-release file was containing:

      # cat /etc/os-release 
      NAME=CoreOS
      ID=coreos
      VERSION=1185.5.0
      VERSION_ID=1185.5.0
      BUILD_ID=2016-12-07-0937
      PRETTY_NAME="CoreOS 1185.5.0 (MoreOS)"
      ANSI_COLOR="1;32"
      HOME_URL="https://coreos.com/"
      BUG_REPORT_URL="https://github.com/coreos/bugs/issues"
      

      It now contains the following:

      NAME="Container Linux by CoreOS"
      ID=coreos
      VERSION=1235.6.0
      VERSION_ID=1235.6.0
      BUILD_ID=2017-01-10-0545
      PRETTY_NAME="Container Linux by CoreOS 1235.6.0 (Ladybug)"
      ANSI_COLOR="38;5;75"
      HOME_URL="https://coreos.com/"
      BUG_REPORT_URL="https://github.com/coreos/bugs/issues"
      

      Notice how CoreOS is now called "Container Linux by CoreOS" which makes the comparison on NAME not trigger.

      The code should better use the ID key as explained in the manpage:
      https://www.freedesktop.org/software/systemd/man/os-release.html

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            masterzen Brice Figureau
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support