summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2011-03-02 00:16:02 +1100
committerJames Turnbull <james@lovedthanlost.net>2011-03-02 00:43:36 +1100
commit3e6217d63c73c720a7d697d810f556adf13f134b (patch)
treed3401a2f15ff4fcccc6be7586d4db5e7e11df616
parent9536252d33f11c31ed0a5b083d0456d999f02e72 (diff)
downloadfacter-3e6217d63c73c720a7d697d810f556adf13f134b.tar.gz
facter-3e6217d63c73c720a7d697d810f556adf13f134b.tar.xz
facter-3e6217d63c73c720a7d697d810f556adf13f134b.zip
Fixes #6521 and other Ruby 1.9 issues
Tested on Ruby 1.9.2p180
-rw-r--r--lib/facter/lsb.rb8
-rw-r--r--lib/facter/util/virtual.rb4
-rw-r--r--lib/facter/util/vlans.rb4
3 files changed, 8 insertions, 8 deletions
diff --git a/lib/facter/lsb.rb b/lib/facter/lsb.rb
index 4b98466..bf4b9db 100644
--- a/lib/facter/lsb.rb
+++ b/lib/facter/lsb.rb
@@ -22,13 +22,13 @@
Facter.add(fact) do
confine :kernel => [ :linux, :"gnu/kfreebsd" ]
setcode do
- unless defined?(@@lsbdata) and defined?(@@lsbtime) and (Time.now.to_i - @@lsbtime.to_i < 5)
+ unless defined?(lsbdata) and defined?(lsbtime) and (Time.now.to_i - lsbtime.to_i < 5)
type = nil
- @@lsbtime = Time.now
- @@lsbdata = Facter::Util::Resolution.exec('lsb_release -a 2>/dev/null')
+ lsbtime = Time.now
+ lsbdata = Facter::Util::Resolution.exec('lsb_release -a 2>/dev/null')
end
- if pattern.match(@@lsbdata)
+ if pattern.match(lsbdata)
$1
else
nil
diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb
index 129448e..06b1b6d 100644
--- a/lib/facter/util/virtual.rb
+++ b/lib/facter/util/virtual.rb
@@ -60,8 +60,8 @@ module Facter::Util::Virtual
def self.jail?
path = case Facter.value(:kernel)
- when "FreeBSD": "/sbin"
- when "GNU/kFreeBSD": "/bin"
+ when "FreeBSD" then "/sbin"
+ when "GNU/kFreeBSD" then "/bin"
end
Facter::Util::Resolution.exec("#{path}/sysctl -n security.jail.jailed") == "1"
end
diff --git a/lib/facter/util/vlans.rb b/lib/facter/util/vlans.rb
index 6d226ff..2b2a72f 100644
--- a/lib/facter/util/vlans.rb
+++ b/lib/facter/util/vlans.rb
@@ -12,7 +12,7 @@ module Facter::Util::Vlans
def self.get_vlans
vlans = Array.new
if self.get_vlan_config
- self.get_vlan_config.each do |line|
+ self.get_vlan_config.each_line do |line|
if line =~ /^([0-9A-Za-z]+)\.([0-9]+) /
vlans.insert(-1, $~[2]) if $~[2]
end
@@ -21,4 +21,4 @@ module Facter::Util::Vlans
vlans.join(',')
end
-end
+end