ohai 6.22.0.rc.0 → 6.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/plugins/java.rb +2 -2
- data/lib/ohai/plugins/linux/filesystem.rb +24 -25
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/java_spec.rb +8 -8
- data/spec/unit/plugins/linux/filesystem_spec.rb +29 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d66c2d60f9b4b0168070e6a8f184040ad9bf0bf2
|
4
|
+
data.tar.gz: 458d0975660f2b604020e4c6bce7dd3e40c958e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4c712fa989b69a385f8f9e2688fc82c5039ac6e141b17856e8a8b1f14bc383d72fda737e9a63ab1d7116d44c15658aea5e0b5d606d08cb53192e69ed373c883
|
7
|
+
data.tar.gz: 60614716e19d3709fb82ef6966f284e6c3a05561bbeffb78f67e93b5f6540d2b33229e545abf085a565762dd162ec89657c1748ac3a55e4ca6090da8a1455410
|
data/lib/ohai/plugins/java.rb
CHANGED
@@ -24,10 +24,10 @@ java = Mash.new
|
|
24
24
|
status, stdout, stderr = nil
|
25
25
|
if RUBY_PLATFORM.downcase.include?("darwin")
|
26
26
|
if system("/usr/libexec/java_home >/dev/null 2>&1")
|
27
|
-
status, stdout, stderr = run_command(:no_status_check => true, :command => "java -version")
|
27
|
+
status, stdout, stderr = run_command(:no_status_check => true, :command => "java -mx64m -version")
|
28
28
|
end
|
29
29
|
else
|
30
|
-
status, stdout, stderr = run_command(:no_status_check => true, :command => "java -version")
|
30
|
+
status, stdout, stderr = run_command(:no_status_check => true, :command => "java -mx64m -version")
|
31
31
|
end
|
32
32
|
|
33
33
|
if status == 0
|
@@ -21,35 +21,34 @@ provides "filesystem"
|
|
21
21
|
fs = Mash.new
|
22
22
|
|
23
23
|
# Grab filesystem data from df
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
24
|
+
# df often returns non-zero even when it has useful output, accept it.
|
25
|
+
status, stdout, stderr = run_command(:command => "df -P",
|
26
|
+
:timeout => 120,
|
27
|
+
:no_status_check => true)
|
28
|
+
stdout.each_line do |line|
|
29
|
+
case line
|
30
|
+
when /^Filesystem\s+1024-blocks/
|
31
|
+
next
|
32
|
+
when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
|
33
|
+
filesystem = $1
|
34
|
+
fs[filesystem] = Mash.new
|
35
|
+
fs[filesystem][:kb_size] = $2
|
36
|
+
fs[filesystem][:kb_used] = $3
|
37
|
+
fs[filesystem][:kb_available] = $4
|
38
|
+
fs[filesystem][:percent_used] = $5
|
39
|
+
fs[filesystem][:mount] = $6
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
43
|
# Grab mount information from /bin/mount
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
fs[filesystem][:mount_options] = $4.split(",")
|
52
|
-
end
|
44
|
+
status, stdout, stderr = run_command(:command => "mount", :timeout => 120)
|
45
|
+
stdout.each_line do |line|
|
46
|
+
if line =~ /^(.+?) on (.+?) type (.+?) \((.+?)\)$/
|
47
|
+
filesystem = $1
|
48
|
+
fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
|
49
|
+
fs[filesystem][:mount] = $2
|
50
|
+
fs[filesystem][:fs_type] = $3
|
51
|
+
fs[filesystem][:mount_options] = $4.split(",")
|
53
52
|
end
|
54
53
|
end
|
55
54
|
|
data/lib/ohai/version.rb
CHANGED
@@ -26,11 +26,11 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
|
|
26
26
|
@status = 0
|
27
27
|
@stdout = ""
|
28
28
|
@stderr = "java version \"1.5.0_16\"\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)\nJava HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)"
|
29
|
-
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -version"}).and_return([@status, @stdout, @stderr])
|
29
|
+
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -mx64m -version"}).and_return([@status, @stdout, @stderr])
|
30
30
|
end
|
31
31
|
|
32
|
-
it "should run java -version" do
|
33
|
-
@ohai.should_receive(:run_command).with({:no_status_check => true, :command => "java -version"}).and_return([0, "", "java version \"1.5.0_16\"\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)\nJava HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)"])
|
32
|
+
it "should run java -mx64m -version" do
|
33
|
+
@ohai.should_receive(:run_command).with({:no_status_check => true, :command => "java -mx64m -version"}).and_return([0, "", "java version \"1.5.0_16\"\nJava(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)\nJava HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)"])
|
34
34
|
@ohai._require_plugin("java")
|
35
35
|
end
|
36
36
|
|
@@ -63,7 +63,7 @@ describe Ohai::System, "plugin java (Java5 Client VM)" do
|
|
63
63
|
@status = 1
|
64
64
|
@stdout = ""
|
65
65
|
@stderr = "Some error output here"
|
66
|
-
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -version"}).and_return([@status, @stdout, @stderr])
|
66
|
+
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -mx64m -version"}).and_return([@status, @stdout, @stderr])
|
67
67
|
@ohai._require_plugin("java")
|
68
68
|
@ohai.languages.should_not have_key(:java)
|
69
69
|
end
|
@@ -77,11 +77,11 @@ describe Ohai::System, "plugin java (Java6 Server VM)" do
|
|
77
77
|
@status = 0
|
78
78
|
@stdout = ""
|
79
79
|
@stderr = "java version \"1.6.0_22\"\nJava(TM) 2 Runtime Environment (build 1.6.0_22-b04)\nJava HotSpot(TM) Server VM (build 17.1-b03, mixed mode)"
|
80
|
-
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -version"}).and_return([@status, @stdout, @stderr])
|
80
|
+
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -mx64m -version"}).and_return([@status, @stdout, @stderr])
|
81
81
|
end
|
82
82
|
|
83
|
-
it "should run java -version" do
|
84
|
-
@ohai.should_receive(:run_command).with({:no_status_check => true, :command => "java -version"}).and_return([0, "", "java version \"1.6.0_22\"\nJava(TM) 2 Runtime Environment (build 1.6.0_22-b04)\nJava HotSpot(TM) Server VM (build 17.1-b03, mixed mode)"])
|
83
|
+
it "should run java -mx64m -version" do
|
84
|
+
@ohai.should_receive(:run_command).with({:no_status_check => true, :command => "java -mx64m -version"}).and_return([0, "", "java version \"1.6.0_22\"\nJava(TM) 2 Runtime Environment (build 1.6.0_22-b04)\nJava HotSpot(TM) Server VM (build 17.1-b03, mixed mode)"])
|
85
85
|
@ohai._require_plugin("java")
|
86
86
|
end
|
87
87
|
|
@@ -114,7 +114,7 @@ describe Ohai::System, "plugin java (Java6 Server VM)" do
|
|
114
114
|
@status = 1
|
115
115
|
@stdout = ""
|
116
116
|
@stderr = "Some error output here"
|
117
|
-
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -version"}).and_return([@status, @stdout, @stderr])
|
117
|
+
@ohai.stub!(:run_command).with({:no_status_check => true, :command => "java -mx64m -version"}).and_return([@status, @stdout, @stderr])
|
118
118
|
@ohai._require_plugin("java")
|
119
119
|
@ohai.languages.should_not have_key(:java)
|
120
120
|
end
|
@@ -25,8 +25,23 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
25
25
|
@ohai.stub!(:require_plugin).and_return(true)
|
26
26
|
@ohai.extend(SimpleFromFile)
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
stdout = mock("STDOUT_SKEL")
|
29
|
+
stderr = mock("STDERR_SKEL")
|
30
|
+
stdout.stub!(:each_line).and_yield('')
|
31
|
+
stderr.stub!(:each_line).and_yield('')
|
32
|
+
|
33
|
+
@df_cmd = {
|
34
|
+
:command => "df -P",
|
35
|
+
:timeout => 120,
|
36
|
+
:no_status_check => true
|
37
|
+
}
|
38
|
+
@mount_cmd = {
|
39
|
+
:command => "mount",
|
40
|
+
:timeout => 120,
|
41
|
+
}
|
42
|
+
|
43
|
+
@ohai.stub!(:run_command).with(@df_cmd).and_return([0,stdout,stderr])
|
44
|
+
@ohai.stub!(:run_command).with(@mount_cmd).and_return([0,stdout,stderr])
|
30
45
|
@ohai.stub!(:popen4).with("blkid -s TYPE").and_return(false)
|
31
46
|
@ohai.stub!(:popen4).with("blkid -s UUID").and_return(false)
|
32
47
|
@ohai.stub!(:popen4).with("blkid -s LABEL").and_return(false)
|
@@ -42,7 +57,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
42
57
|
@stdout = mock("STDOUT")
|
43
58
|
@status = 0
|
44
59
|
|
45
|
-
@stdout.stub!(:
|
60
|
+
@stdout.stub!(:each_line).
|
46
61
|
and_yield("Filesystem 1024-blocks Used Available Capacity Mounted on").
|
47
62
|
and_yield("/dev/mapper/sys.vg-root.lv 4805760 378716 4182924 9% /").
|
48
63
|
and_yield("tmpfs 2030944 0 2030944 0% /lib/init/rw").
|
@@ -57,36 +72,36 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
57
72
|
end
|
58
73
|
|
59
74
|
it "should run df -P" do
|
60
|
-
@ohai.should_receive(:
|
75
|
+
@ohai.should_receive(:run_command).with(@df_cmd).and_return(true)
|
61
76
|
@ohai._require_plugin("linux::filesystem")
|
62
77
|
end
|
63
78
|
|
64
79
|
it "should set kb_size to value from df -P" do
|
65
|
-
@ohai.stub!(:
|
80
|
+
@ohai.stub!(:run_command).with(@df_cmd).and_return([@status, @stdout, @stderr])
|
66
81
|
@ohai._require_plugin("linux::filesystem")
|
67
82
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_size].should be == "97605057"
|
68
83
|
end
|
69
84
|
|
70
85
|
it "should set kb_used to value from df -P" do
|
71
|
-
@ohai.stub!(:
|
86
|
+
@ohai.stub!(:run_command).with(@df_cmd).and_return([@status, @stdout, @stderr])
|
72
87
|
@ohai._require_plugin("linux::filesystem")
|
73
88
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_used].should be == "53563253"
|
74
89
|
end
|
75
90
|
|
76
91
|
it "should set kb_available to value from df -P" do
|
77
|
-
@ohai.stub!(:
|
92
|
+
@ohai.stub!(:run_command).with(@df_cmd).and_return([@status, @stdout, @stderr])
|
78
93
|
@ohai._require_plugin("linux::filesystem")
|
79
94
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:kb_available].should be == "44041805"
|
80
95
|
end
|
81
96
|
|
82
97
|
it "should set percent_used to value from df -P" do
|
83
|
-
@ohai.stub!(:
|
98
|
+
@ohai.stub!(:run_command).with(@df_cmd).and_return([@status, @stdout, @stderr])
|
84
99
|
@ohai._require_plugin("linux::filesystem")
|
85
100
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:percent_used].should be == "56%"
|
86
101
|
end
|
87
102
|
|
88
103
|
it "should set mount to value from df -P" do
|
89
|
-
@ohai.stub!(:
|
104
|
+
@ohai.stub!(:run_command).with(@df_cmd).and_return([@status, @stdout, @stderr])
|
90
105
|
@ohai._require_plugin("linux::filesystem")
|
91
106
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount].should be == "/special"
|
92
107
|
end
|
@@ -100,7 +115,7 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
100
115
|
@stdout = mock("STDOUT")
|
101
116
|
@status = 0
|
102
117
|
|
103
|
-
@stdout.stub!(:
|
118
|
+
@stdout.stub!(:each_line).
|
104
119
|
and_yield("/dev/mapper/sys.vg-root.lv on / type ext4 (rw,noatime,errors=remount-ro)").
|
105
120
|
and_yield("tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)").
|
106
121
|
and_yield("proc on /proc type proc (rw,noexec,nosuid,nodev)").
|
@@ -119,24 +134,24 @@ describe Ohai::System, "Linux filesystem plugin" do
|
|
119
134
|
end
|
120
135
|
|
121
136
|
it "should run mount" do
|
122
|
-
@ohai.
|
137
|
+
@ohai.stub!(:run_command).with(@mount_cmd).and_return([@status, @stdout, @stderr])
|
123
138
|
@ohai._require_plugin("linux::filesystem")
|
124
139
|
end
|
125
140
|
|
126
141
|
it "should set mount to value from mount" do
|
127
|
-
@ohai.stub!(:
|
142
|
+
@ohai.stub!(:run_command).with(@mount_cmd).and_return([@status, @stdout, @stderr])
|
128
143
|
@ohai._require_plugin("linux::filesystem")
|
129
144
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount].should be == "/special"
|
130
145
|
end
|
131
146
|
|
132
147
|
it "should set fs_type to value from mount" do
|
133
|
-
@ohai.stub!(:
|
148
|
+
@ohai.stub!(:run_command).with(@mount_cmd).and_return([@status, @stdout, @stderr])
|
134
149
|
@ohai._require_plugin("linux::filesystem")
|
135
150
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:fs_type].should be == "xfs"
|
136
151
|
end
|
137
152
|
|
138
153
|
it "should set mount_options to an array of values from mount" do
|
139
|
-
@ohai.stub!(:
|
154
|
+
@ohai.stub!(:run_command).with(@mount_cmd).and_return([@status, @stdout, @stderr])
|
140
155
|
@ohai._require_plugin("linux::filesystem")
|
141
156
|
@ohai[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount_options].should be == [ "ro", "noatime" ]
|
142
157
|
end
|
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: 6.22.0
|
4
|
+
version: 6.22.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: 2014-
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -430,9 +430,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
430
430
|
version: '0'
|
431
431
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
432
432
|
requirements:
|
433
|
-
- - "
|
433
|
+
- - ">="
|
434
434
|
- !ruby/object:Gem::Version
|
435
|
-
version:
|
435
|
+
version: '0'
|
436
436
|
requirements: []
|
437
437
|
rubyforge_project:
|
438
438
|
rubygems_version: 2.2.2
|