ohai 13.2.0 → 13.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c77bbdaf5110dc3837d208227d35171c3abd7d7
4
- data.tar.gz: 2781b142b0bf7b9201edbbb01b82d005f0703165
3
+ metadata.gz: 82da0b1a779fb8c56cc2d219a02483ee0cb1b457
4
+ data.tar.gz: ca97f22a9aa2765a92d5ff2e5526f9f1a49e8caf
5
5
  SHA512:
6
- metadata.gz: 4b0e442fe9e3506dac3b41c9f2cd239c04f649581df61f4302fe510e898f5dd4fff1ec8741704c0075025f3f76d98f5af55fb6beb8e5abd899803ffda6c014f2
7
- data.tar.gz: e18343490101bc00c3f385b13d875f56c12c4724a404a2b1a30d863975fac898ce193330f600ef8d9a652eb7bff3a97df367ad2137fd73f914dcbaef3e2cff08
6
+ metadata.gz: 76632d8ec3f46c4a926a8478de23248f364dedd4f088a9e93cce359bd5d2c7314955d6858e78be9d3b7df229f7eba8286e1048cc3584195aca62056dbef5e8fd
7
+ data.tar.gz: 8f486adaead3001cdb19f51ee4c4c14eb6329664671f1b334f7198654d89387f5759ea1c4f67c31811b98cecb1751e63eb581d5624a6cdf6c975511daa52cdab
@@ -162,7 +162,10 @@ Ohai.plugin(:Filesystem) do
162
162
 
163
163
  cmds.each do |cmd|
164
164
  cmdtype = File.basename(cmd.split.first)
165
- so = shell_out(cmd)
165
+ # setting the timeout here for `lsblk` and `blkid` commands to 60
166
+ # this is to allow machines with large amounts of attached LUNs
167
+ # to respond back to the command successfully
168
+ so = shell_out(cmd, timeout: 60)
166
169
  so.stdout.each_line do |line|
167
170
  parsed = parse_line(line, cmdtype)
168
171
  next if parsed.nil?
@@ -85,6 +85,19 @@ Ohai.plugin(:Platform) do
85
85
  nil
86
86
  end
87
87
 
88
+ #
89
+ # Determines the platform version for F5 Big-IP systems
90
+ #
91
+ # @returns [String] bigip Linux version from /etc/f5-release
92
+ #
93
+ def bigip_version
94
+ release_contents = File.read("/etc/f5-release")
95
+ release_contents.match(/BIG-IP release (\S*)/)[1] # http://rubular.com/r/O8nlrBVqSb
96
+ rescue NoMethodError, Errno::ENOENT, Errno::EACCES # rescue regex failure, file missing, or permission denied
97
+ Ohai::Log.warn("Detected F5 Big-IP, but /etc/f5-release could not be parsed to determine platform_version")
98
+ nil
99
+ end
100
+
88
101
  #
89
102
  # Determines the platform version for Debian based systems
90
103
  #
@@ -107,7 +120,7 @@ Ohai.plugin(:Platform) do
107
120
  case platform
108
121
  when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/
109
122
  "debian"
110
- when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
123
+ when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/, /bigip/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
111
124
  "rhel"
112
125
  when /amazon/
113
126
  "amazon"
@@ -142,6 +155,9 @@ Ohai.plugin(:Platform) do
142
155
  contents = File.read("/etc/enterprise-release").chomp
143
156
  platform "oracle"
144
157
  platform_version get_redhatish_version(contents)
158
+ elsif File.exist?("/etc/f5-release")
159
+ platform "bigip"
160
+ platform_version bigip_version
145
161
  elsif File.exist?("/etc/debian_version")
146
162
  # Ubuntu and Debian both have /etc/debian_version
147
163
  # Ubuntu should always have a working lsb, debian does not by default
@@ -103,7 +103,8 @@ Ohai.plugin(:Network) do
103
103
  cint = nil
104
104
 
105
105
  so.stdout.lines do |line|
106
- if line =~ /^([0-9a-zA-Z\.\:\-]+)\S/
106
+ # regex: http://rubular.com/r/Iag7JLVTVe
107
+ if line =~ /^([0-9a-zA-Z\.\:\-]+): \S+ mtu (\d+) index (\d+)/
107
108
  cint = $1
108
109
  iface[cint] = Mash.new unless iface[cint]
109
110
  iface[cint][:mtu] = $2
data/lib/ohai/version.rb CHANGED
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = "13.2.0"
21
+ VERSION = "13.3.0"
22
22
  end
@@ -28,10 +28,10 @@ describe Ohai::System, "Linux filesystem plugin" do
28
28
  allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, "", ""))
29
29
  allow(plugin).to receive(:which).with("lsblk").and_return(nil)
30
30
  allow(plugin).to receive(:which).with("blkid").and_return("/sbin/blkid")
31
- allow(plugin).to receive(:shell_out).with("/sbin/blkid").and_return(mock_shell_out(0, "", ""))
31
+ allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, "", ""))
32
32
 
33
33
  allow(plugin).to receive(:shell_out).
34
- with("lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
34
+ with("lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
35
35
  and_return(mock_shell_out(0, "", ""))
36
36
 
37
37
  allow(File).to receive(:exist?).with("/proc/mounts").and_return(false)
@@ -219,7 +219,7 @@ DFi
219
219
  /dev/mapper/sys.vg-var.lv: LABEL=\"/var\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" TYPE=\"ext4\"
220
220
  /dev/mapper/sys.vg-home.lv: LABEL=\"/home\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" TYPE=\"xfs\"
221
221
  BLKID_TYPE
222
- allow(plugin).to receive(:shell_out).with("/sbin/blkid").and_return(mock_shell_out(0, @stdout, ""))
222
+ allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
223
223
  end
224
224
 
225
225
  it "should run blkid" do
@@ -279,7 +279,7 @@ NAME=\"sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/h
279
279
  NAME=\"debian--7-root (dm-0)\" UUID=\"09187faa-3512-4505-81af-7e86d2ccb99a\" LABEL=\"root\" FSTYPE=\"ext4\"
280
280
  BLKID_TYPE
281
281
  allow(plugin).to receive(:shell_out).
282
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
282
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
283
283
  and_return(mock_shell_out(0, @stdout, ""))
284
284
  end
285
285
 
@@ -346,7 +346,7 @@ NAME=\"sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/B
346
346
  NAME=\"debian--7-root (dm-0)\" UUID=\"09187faa-3512-4505-81af-7e86d2ccb99a\" LABEL=\"root\" FSTYPE=\"ext4\"
347
347
  BLKID_TYPE
348
348
  allow(plugin).to receive(:shell_out).
349
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
349
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
350
350
  and_return(mock_shell_out(0, @stdout, ""))
351
351
  @stdout = <<-BLKID_TYPE
352
352
  /dev/sdb1: LABEL=\"fuego:0\" TYPE=\"linux_raid_member\"
@@ -362,7 +362,7 @@ BLKID_TYPE
362
362
  /dev/mapper/sys.vg-var.lv: LABEL=\"/var\" UUID=\"6b559c35-7847-4ae2-b512-c99012d3f5b3\" TYPE=\"ext4\"
363
363
  /dev/mapper/sys.vg-home.lv: LABEL=\"/home\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" TYPE=\"xfs\"
364
364
  BLKID_TYPE
365
- allow(plugin).to receive(:shell_out).with("/sbin/blkid").and_return(mock_shell_out(0, @stdout, ""))
365
+ allow(plugin).to receive(:shell_out).with("/sbin/blkid", timeout: 60).and_return(mock_shell_out(0, @stdout, ""))
366
366
  end
367
367
 
368
368
  it "should fill in missing FS data from lsblk using blkid" do
@@ -473,7 +473,7 @@ NAME=\"/dev/mapper/sys.vg-root.lv\" UUID=\"7742d14b-80a3-4e97-9a32-478be9ea9aea\
473
473
  NAME=\"/dev/mapper/sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
474
474
  BLKID_TYPE
475
475
  allow(plugin).to receive(:shell_out).
476
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
476
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
477
477
  and_return(mock_shell_out(0, @stdout, ""))
478
478
  end
479
479
 
@@ -520,7 +520,7 @@ NAME=\"/dev/sdc1\" UUID=\"7f1e51bf-3608-4351-b7cd-379e39cff36a\" LABEL=\"/mnt\"
520
520
  NAME=\"/dev/mapper/sys.vg-home.lv\" UUID=\"d6efda02-1b73-453c-8c74-7d8dee78fa5e\" LABEL=\"/home\" FSTYPE=\"xfs\"
521
521
  BLKID_TYPE
522
522
  allow(plugin).to receive(:shell_out).
523
- with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE").
523
+ with("/sbin/lsblk -n -P -o NAME,UUID,LABEL,FSTYPE", timeout: 60).
524
524
  and_return(mock_shell_out(0, @stdout, ""))
525
525
  end
526
526
 
@@ -37,6 +37,7 @@ describe Ohai::System, "Linux plugin platform" do
37
37
  let(:have_os_release) { false }
38
38
  let(:have_usr_lib_os_release) { false }
39
39
  let(:have_cisco_release) { false }
40
+ let(:have_f5_release) { false }
40
41
  let(:have_cumulus_dir) { false }
41
42
 
42
43
  before(:each) do
@@ -58,6 +59,7 @@ describe Ohai::System, "Linux plugin platform" do
58
59
  allow(File).to receive(:exist?).with("/etc/parallels-release").and_return(have_parallels_release)
59
60
  allow(File).to receive(:exist?).with("/usr/bin/raspi-config").and_return(have_raspi_config)
60
61
  allow(File).to receive(:exist?).with("/etc/os-release").and_return(have_os_release)
62
+ allow(File).to receive(:exist?).with("/etc/f5-release").and_return(have_f5_release)
61
63
  allow(File).to receive(:exist?).with("/usr/lib/os-release").and_return(have_usr_lib_os_release)
62
64
  allow(File).to receive(:exist?).with("/etc/shared/os-release").and_return(have_cisco_release)
63
65
  allow(Dir).to receive(:exist?).with("/etc/cumulus").and_return(have_cumulus_dir)
@@ -309,6 +311,23 @@ OS_RELEASE
309
311
  end
310
312
  end
311
313
 
314
+ describe "on f5 big-ip" do
315
+
316
+ let(:have_f5_release) { true }
317
+
318
+ before(:each) do
319
+ @plugin.lsb = nil
320
+ end
321
+
322
+ it "should set platform to bigip" do
323
+ expect(File).to receive(:read).with("/etc/f5-release").and_return("BIG-IP release 13.0.0 (Final)")
324
+ @plugin.run
325
+ expect(@plugin[:platform]).to eq("bigip")
326
+ expect(@plugin[:platform_family]).to eq("rhel")
327
+ expect(@plugin[:platform_version]).to eq("13.0.0")
328
+ end
329
+ end
330
+
312
331
  describe "on exherbo" do
313
332
 
314
333
  let(:have_exherbo_release) { true }
@@ -69,9 +69,7 @@ lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
69
69
  eri0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 \
70
70
  index 2
71
71
  inet 172.17.128.208 netmask ffffff00 broadcast 172.17.128.255
72
- ip6.tun0: flags=10008d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST,IPv4> \
73
- mtu 1460
74
- index 3
72
+ ip6.tun0: flags=10008d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST,IPv4> mtu 1460 index 3
75
73
  inet6 tunnel src fe80::1 tunnel dst fe80::2
76
74
  tunnel security settings --> use 'ipsecconf -ln -i ip.tun1'
77
75
  tunnel hop limit 60 tunnel encapsulation limit 4
@@ -80,8 +78,7 @@ qfe1: flags=2000841<UP,RUNNING,MULTICAST,IPv6> mtu 1500 index 3
80
78
  usesrc vni0
81
79
  inet6 fe80::203:baff:fe17:4be0/10
82
80
  ether 0:3:ba:17:4b:e0
83
- vni0: flags=2002210041<UP,RUNNING,NOXMIT,NONUD,IPv6,VIRTUAL> mtu 0
84
- index 5
81
+ vni0: flags=2002210041<UP,RUNNING,NOXMIT,NONUD,IPv6,VIRTUAL> mtu 1460 index 5
85
82
  srcof qfe1
86
83
  inet6 fe80::203:baff:fe17:4444/128
87
84
  ENDIFCONFIG
@@ -176,7 +173,7 @@ ROUTE_GET
176
173
  end
177
174
 
178
175
  it "finds the default interface for a solaris 11 zone" do
179
- expect(@plugin[:network][:default_interface]).to eq("net1")
176
+ expect(@plugin[:network][:default_interface]).to eq("net1:1")
180
177
  end
181
178
  end
182
179
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.0
4
+ version: 13.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-29 00:00:00.000000000 Z
11
+ date: 2017-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu