Feature #3636
open
Regex support in matcher-values of smart variables and parameters
Added by Finke Lamein about 11 years ago.
Updated over 7 years ago.
Description
The following would be nice functionality I think
Matching on something like: os =~ ^RedHat 6.* would greatly simplify doing stuff for different major versions of a specific distro.
lsbdistcodename is insufficient as all versions of CentOS report Final as codename.
operatingsystemmajrelease is insufficient as well, as that will also match Debian 6.x
Alternatively matching multiple facts using and/or logic would work as well.
osfamily = RedHat and (&&) operatingsystemmajrelease = 6
- Category set to Parameters
- Related to Feature #3848: Matcher value for smart variables against array added
As extra sidenote:
as it stands now, there seems to be no way to differentiate between different CentOS major versions.
all the known facts, regarding OS versions
lsbmajdistrelease 6
operatingsystemmajrelease 6
operatingsystemrelease 6.4
lsbdistrelease 6.4
operatingsystem CentOS
lsbdistid CentOS
lsbdistdescription CentOS release 6.4 (Final) <--- Using regexes we could match this one as "^CentOS release 6\."
lsbdistcodename Final <--- this one being the major culprit, All CentOS releases are codenamed Final
osfamily RedHat
We actually fixed this use case with a custom fact as follows:
Facter.add("familygeneration") do
setcode do
family = Facter.value('osfamily')
major = Facter.value('operatingsystemmajrelease')
major = Facter.value('lsbmajdistrelease') if major.nil?
family + " " + major
end
end
Probably there are still some use cases in which regex support is more neat.
Greetings Finke
- Related to Feature #3309: Support deep merging of hash structures in smart class parameters added
- Status changed from New to Assigned
- Assignee set to Ori Rabin
- Target version set to 1.7.4
- Subject changed from Regex support in matcher-values of smart variables to Regex support in matcher-values of smart variables and parameters
Would be useful for smart class parameters as well.
- Bugzilla link set to 1132453
- Target version changed from 1.7.4 to 1.7.3
- Target version deleted (
1.7.3)
- Related to Tracker #4470: Usability of parameters and overrides added
- Status changed from Assigned to New
- Assignee deleted (
Ori Rabin)
Also available in: Atom
PDF