[Pkg-puppet-devel] [facter] 98/180: (FACT_451) Use parser for /etc/os-release for operatingsystemrelease
Stig Sandbeck Mathisen
ssm at debian.org
Mon Jun 30 15:06:35 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit 8e107264dc2b55290bc31f5ac19b4cc349459f9a
Author: Adrien Thebo <git at somethingsinistral.net>
Date: Tue May 13 15:48:05 2014 -0700
(FACT_451) Use parser for /etc/os-release for operatingsystemrelease
---
lib/facter/operatingsystemrelease.rb | 7 ++-----
spec/unit/operatingsystemrelease_spec.rb | 4 ++--
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/lib/facter/operatingsystemrelease.rb b/lib/facter/operatingsystemrelease.rb
index 3b9c21f..f980963 100644
--- a/lib/facter/operatingsystemrelease.rb
+++ b/lib/facter/operatingsystemrelease.rb
@@ -17,6 +17,7 @@
# Caveats:
#
+require 'facter/util/operatingsystem'
require 'facter/util/file_read'
Facter.add(:operatingsystemrelease) do
@@ -74,11 +75,7 @@ end
Facter.add(:operatingsystemrelease) do
confine :operatingsystem => 'CumulusLinux'
setcode do
- if release = Facter::Util::FileRead.read('/etc/os-release')
- if match = release.match(/VERSION_ID=["']?(.+?)["']?$/)
- match[1]
- end
- end
+ Facter::Util::Operatingsystem.os_release['VERSION_ID']
end
end
diff --git a/spec/unit/operatingsystemrelease_spec.rb b/spec/unit/operatingsystemrelease_spec.rb
index 8acfdcf..1492c5b 100755
--- a/spec/unit/operatingsystemrelease_spec.rb
+++ b/spec/unit/operatingsystemrelease_spec.rb
@@ -226,10 +226,10 @@ describe "Operating System Release fact" do
end
end
- it "for Cumulus Linux" do
+ it "uses '/etc/os-release for Cumulus Linux" do
Facter.fact(:kernel).stubs(:value).returns("Linux")
Facter.fact(:operatingsystem).stubs(:value).returns("CumulusLinux")
- File.expects(:read).with("/etc/os-release").returns("VERSION_ID=1.5.0")
+ Facter::Util::Operatingsystem.expects(:os_release).returns({'VERSION_ID' => '1.5.0'})
Facter.fact(:operatingsystemrelease).value.should == "1.5.0"
end
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list