Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve VMware Photon OS detection #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

smortex
Copy link
Contributor

@smortex smortex commented Nov 25, 2022

When running the facts::bash task targetting a VMWare Photon OS 4.0 system, the task return:

  {
    "os": {
      "name": "Distribution information.",
      "distro": {
        "codename": "Distribution information."
      },
      "release": {
        "full": "Distribution information.",
        "major": "Distribution information",
        "minor": ""
      },
      "family": "PhotonOS"
    }
  }

Using the facts::ruby task on the same target we get these values from facter:

  {
    "os": {
      "release": {
        "full": "4.0",
        "major": "4",
        "minor": "0"
      },
      "name": "VMware",
      "distro": {
        "id": "VMware Photon OS",
        "release": {
          "full": "4.0",
          "major": "4",
          "minor": "0"
        },
        "codename": "Photon",
        "description": "VMware Photon OS 4.0"
      },
      "architecture": "x86_64",
      "hardware": "x86_64",
      "family": "Redhat",
      "selinux": {
        "enabled": false
      }
    }
  }

Adjust the bash implementation so that the facts match those returned by facter:

  • Identify Photon OS as a RedHat derivative;
  • Only consider the first line of /etc/<distro>-release to find the codename;
  • When the release information does not have a codename in parenthesis, try to match well-known patterns to find the codename anyway;
  • Attempt to find a version event when it is not after the 'release' word in the release information;

With these changes, the facts::bash task targetting the above system returns the following that better match the output from facter:

  {
    "os": {
      "name": "VMware",
      "distro": {
        "codename": "Photon"
      },
      "release": {
        "full": "4.0",
        "major": "4",
        "minor": "0"
      },
      "family": "RedHat"
    }
  }

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
When running the `facts::bash` task targetting a VMWare Photon OS 4.0
system, the task return:

```
  {
    "os": {
      "name": "Distribution information.",
      "distro": {
        "codename": "Distribution information."
      },
      "release": {
        "full": "Distribution information.",
        "major": "Distribution information",
        "minor": ""
      },
      "family": "PhotonOS"
    }
  }
```

Using the `facts::ruby` task on the same target we get these values from
facter:

```
  {
    "os": {
      "release": {
        "full": "4.0",
        "major": "4",
        "minor": "0"
      },
      "name": "VMware",
      "distro": {
        "id": "VMware Photon OS",
        "release": {
          "full": "4.0",
          "major": "4",
          "minor": "0"
        },
        "codename": "Photon",
        "description": "VMware Photon OS 4.0"
      },
      "architecture": "x86_64",
      "hardware": "x86_64",
      "family": "Redhat",
      "selinux": {
        "enabled": false
      }
    }
  }
```

Adjust the bash implementation so that the facts match those returned by
facter:
  * Identify Photon OS as a RedHat derivative;
  * Only consider the first line of /etc/<distro>-release to find the
    codename;
  * When the release information does not have a codename in
    parenthesis, try to match well-known patterns to find the codename
    anyway;
  * Attempt to find a version event when it is not after the 'release'
    word in the release information;

With these changes, the `facts::bash` task targetting the above system
returns the following that better match the output from facter:

```
  {
    "os": {
      "name": "VMware",
      "distro": {
        "codename": "Photon"
      },
      "release": {
        "full": "4.0",
        "major": "4",
        "minor": "0"
      },
      "family": "RedHat"
    }
  }
```
@smortex smortex requested a review from a team as a code owner November 25, 2022 00:32
Copy link
Contributor

@donoghuc donoghuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. @m0dular you have done quite a bit with this implementation, any concerns with this?

@m0dular
Copy link
Contributor

m0dular commented Dec 6, 2022

Sorry for the late response @donoghuc and @smortex, this is great! I'm good with merging it.

@CLAassistant
Copy link

CLAassistant commented Apr 19, 2023

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants