(#21260) Add Cumulus Linux detection support#458
(#21260) Add Cumulus Linux detection support#458dorkmatt wants to merge 10 commits intopuppetlabs:masterfrom CumulusNetworks:master
Conversation
|
CLA Signed by dorkmatt on 2012-10-02 21:00:00 -0700 |
lib/facter/operatingsystem.rb
Outdated
There was a problem hiding this comment.
Is /etc/os-release going to be unique for Cumulus Linux? Do we have to do a regex to extract this value or can we rely on the presence of the file?
There was a problem hiding this comment.
The file is /etc/os-release is supported in a number a OS's these days - Gentoo, Ubuntu and of course Cumulus Linux. The regex value is to extract a certain data point from this file.
There was a problem hiding this comment.
Well that's pretty nifty. However if this is present on a number of platforms it could change existing behavior. Line 39 may mitigate this, but this might be a bit aggressive.
Perhaps this could be a fallback behavior instead of the first option selected?
There was a problem hiding this comment.
The problem here is the existing logic, Cumulus Linux ships with a /etc/debian_version to show our OS heritage (such as Ubuntu does too) - even though both Cumulus & Ubuntu are clearly not Debian. I'm happy to change that logic too, but wanted to do the least amount of impact on other OS selections - thoughts here?
There was a problem hiding this comment.
I was afraid of that. I want to ensure that our primary supported platforms (Ubuntu, Debian, CentOS, Redhat) won't regress with this change, and if not then this is great. I don't want to make this PR diverge too much from the goal of getting in Cumulus Linux support, but I can't offer a lot of great solutions aside from manual verification.
There was a problem hiding this comment.
I just ran into a snag with this, because of how Debian formats /etc/os-release
PRETTY_NAME="Debian GNU/Linux 7.0 (wheezy)" NAME="Debian GNU/Linux" VERSION_ID="7.0" VERSION="7.0 (wheezy)" ID=debian ANSI_COLOR="1;31" HOME_URL="http://www.debian.org/" SUPPORT_URL="http://www.debian.org/support/" BUG_REPORT_URL="http://bugs.debian.org/"
We can't normalize the value of NAME with a regex so this can't be a general solution. I think it could be a fallback mechanism but I really don't want to change the operatingsystem fact on debian to debiangnulinux
|
Thank you very much for this contribution! It would be good to have test coverage for these changes, to ensure that these changes don't accidentally regress. Would you be able to get sample output from |
|
I noticed this hasn't seen any activity in about a week. Is there a chance you'll be able to work on this in the coming week? No pressure, just checking in. |
Cumulus Linux RSpec additions
|
We've added an initial round of rspec unit tests, as requested here's some examples of |
lib/facter/operatingsystem.rb
Outdated
There was a problem hiding this comment.
Two comments on this:
Using global match variables like $1 isn't threadsafe; it's better to use an explicit MatchData variable:
matchdata = File.read('/etc/os-release').match /^NAME=["']?(.+?)["']?$/
matchdata[1]In addition, this regular expression is pretty aggressive. Do we really want to strip out numbers or underscores?
As mentioned above if this is a fallback option that would be fine, but I would like to avoid defaulting to the more intrusive option.
There was a problem hiding this comment.
The agressive regex was to follow other setcode's for the operatingsystem fact - all of which seem to have mixed upper/lower case and no spaces.
There was a problem hiding this comment.
Fair point. We don't have a formal convention around the output of operatingsystem fact names. On one hand I am nervous about this breaking things, but on the other hand it would be nice to actually have that convention.
|
Does Cumulus Linux have a file like |
|
Not currently, our entire point was to not invent yet-another-standard. |
|
👍 for not inventing a new standard. So here's what I think we need to do to handle this:
We can't use |
|
CLA signed by all contributors. |
|
I'm closing this in favor of GH-493; if this is in error let me know. |
No description provided.