[Pkg-puppet-devel] [facter] 18/352: (#12504) Read non-configurable file for operatingsystemrelease on Ubuntu
Stig Sandbeck Mathisen
ssm at debian.org
Sun Apr 6 22:21:27 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 5dac5e441f744b8a79490464a2a7603af5cf6868
Author: Garrett Honeycutt <code at garretthoneycutt.com>
Date: Wed Sep 11 20:17:14 2013 -0400
(#12504) Read non-configurable file for operatingsystemrelease on Ubuntu
Without this patch, the operatingsystemrelease for Ubuntu is gathered by
parsing /etc/issue. This is a problem as /etc/issue is meant to have
configurable content to optionally be displayed when logging in to a
system. This patch uses /etc/lsb-release which is meant to have static
data describing the release version.
---
lib/facter/operatingsystemrelease.rb | 2 +-
spec/unit/operatingsystemrelease_spec.rb | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/facter/operatingsystemrelease.rb b/lib/facter/operatingsystemrelease.rb
index 7653cbe..f0d3512 100644
--- a/lib/facter/operatingsystemrelease.rb
+++ b/lib/facter/operatingsystemrelease.rb
@@ -5,7 +5,7 @@
# Resolution:
# On RedHat derivatives, returns their '/etc/<variant>-release' file.
# On Debian, returns '/etc/debian_version'.
-# On Ubuntu, parses '/etc/issue' for the release version.
+# On Ubuntu, parses '/etc/lsb-release' for the release version.
# On Suse, derivatives, parses '/etc/SuSE-release' for a selection of version
# information.
# On Slackware, parses '/etc/slackware-version'.
diff --git a/spec/unit/operatingsystemrelease_spec.rb b/spec/unit/operatingsystemrelease_spec.rb
index cda20fe..7aab1e0 100755
--- a/spec/unit/operatingsystemrelease_spec.rb
+++ b/spec/unit/operatingsystemrelease_spec.rb
@@ -154,14 +154,14 @@ describe "Operating System Release fact" do
end
context "Ubuntu" do
- let(:issue) { "Ubuntu 10.04.4 LTS \\n \\l\n\n" }
+ let(:lsbrelease) { 'DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=10.04\nDISTRIB_CODENAME=lucid\nDISTRIB_DESCRIPTION="Ubuntu 10.04.4 LTS"'}
before :each do
Facter.fact(:kernel).stubs(:value).returns("Linux")
Facter.fact(:operatingsystem).stubs(:value).returns("Ubuntu")
end
it "Returns only the major and minor version (not patch version)" do
- Facter::Util::FileRead.stubs(:read).with("/etc/issue").returns(issue)
+ Facter::Util::FileRead.stubs(:read).with("/etc/lsb-release").returns(lsbrelease)
Facter.fact(:operatingsystemrelease).value.should == "10.04"
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