rubyipmi 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -8
- data/README.md +92 -27
- data/Rakefile +1 -6
- data/VERSION +1 -1
- data/lib/rubyipmi.rb +69 -30
- data/lib/rubyipmi/commands/basecommand.rb +16 -18
- data/lib/rubyipmi/freeipmi/commands/basecommand.rb +2 -4
- data/lib/rubyipmi/freeipmi/commands/bmc.rb +7 -0
- data/lib/rubyipmi/freeipmi/commands/bmcconfig.rb +10 -0
- data/lib/rubyipmi/freeipmi/commands/bmcdevice.rb +1 -0
- data/lib/rubyipmi/freeipmi/commands/bmcinfo.rb +0 -3
- data/lib/rubyipmi/freeipmi/commands/chassis.rb +1 -0
- data/lib/rubyipmi/freeipmi/commands/chassisconfig.rb +0 -2
- data/lib/rubyipmi/freeipmi/commands/fru.rb +0 -1
- data/lib/rubyipmi/freeipmi/commands/lan.rb +22 -23
- data/lib/rubyipmi/freeipmi/commands/sensors.rb +8 -7
- data/lib/rubyipmi/freeipmi/connection.rb +14 -19
- data/lib/rubyipmi/freeipmi/errorcodes.rb +0 -1
- data/lib/rubyipmi/ipmitool/commands/basecommand.rb +0 -3
- data/lib/rubyipmi/ipmitool/commands/bmc.rb +8 -0
- data/lib/rubyipmi/ipmitool/commands/chassis.rb +1 -0
- data/lib/rubyipmi/ipmitool/commands/fru.rb +0 -7
- data/lib/rubyipmi/ipmitool/connection.rb +12 -13
- data/lib/rubyipmi/ipmitool/errorcodes.rb +2 -1
- data/rubyipmi.gemspec +21 -14
- data/spec/integration/bmc_spec.rb +9 -10
- data/spec/integration/chassis_config_spec.rb +6 -8
- data/spec/integration/chassis_spec.rb +3 -3
- data/spec/integration/connection_spec.rb +16 -15
- data/spec/integration/fru_spec.rb +6 -7
- data/spec/integration/lan_spec.rb +21 -34
- data/spec/integration/power_spec.rb +5 -5
- data/spec/integration/rubyipmi_spec.rb +63 -9
- data/spec/integration/sensor_spec.rb +7 -8
- data/spec/spec_helper.rb +10 -7
- data/spec/unit/freeipmi/bmc-info_spec.rb +5 -6
- data/spec/unit/freeipmi/bmc_spec.rb +8 -9
- data/spec/unit/freeipmi/connection_spec.rb +41 -23
- data/spec/unit/freeipmi/errorcodes_spec.rb +4 -10
- data/spec/unit/freeipmi/fru_spec.rb +15 -16
- data/spec/unit/freeipmi/sensors_spec.rb +17 -15
- data/spec/unit/ipmitool/bmc_spec.rb +11 -12
- data/spec/unit/ipmitool/connection_spec.rb +43 -21
- data/spec/unit/ipmitool/errorcodes_spec.rb +5 -4
- data/spec/unit/ipmitool/fru_spec.rb +15 -15
- data/spec/unit/ipmitool/lan_spec.rb +16 -15
- data/spec/unit/ipmitool/sensors_spec.rb +16 -15
- data/spec/unit/rubyipmi_spec.rb +6 -6
- metadata +64 -24
- data/README.rdoc +0 -18
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
|
2
3
|
describe "Lan" do
|
3
4
|
|
4
5
|
before :all do
|
@@ -11,7 +12,7 @@ describe "Lan" do
|
|
11
12
|
user = "ipmiuser"
|
12
13
|
pass = "impipass"
|
13
14
|
host = "ipmihost"
|
14
|
-
Rubyipmi.
|
15
|
+
allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
|
15
16
|
@conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
|
16
17
|
@lan = @conn.bmc.lan
|
17
18
|
data = nil
|
@@ -19,9 +20,9 @@ describe "Lan" do
|
|
19
20
|
data = file.read
|
20
21
|
end
|
21
22
|
|
22
|
-
@lan.
|
23
|
-
@lan.
|
24
|
-
|
23
|
+
allow(@lan).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
|
24
|
+
allow(@lan).to receive(:`).and_return(data)
|
25
|
+
allow($?).to receive(:success?).and_return(true)
|
25
26
|
end
|
26
27
|
|
27
28
|
it "cmd should be lan with correct number of arguments" do
|
@@ -30,44 +31,44 @@ describe "Lan" do
|
|
30
31
|
end
|
31
32
|
|
32
33
|
it "can return a lan information" do
|
33
|
-
@lan.info.
|
34
|
+
expect(@lan.info).not_to be_nil
|
34
35
|
end
|
35
36
|
|
36
37
|
it "can print valid lan info" do
|
37
|
-
@lan.info.length.
|
38
|
+
expect(@lan.info.length).to be > 1
|
38
39
|
end
|
39
40
|
|
40
41
|
it 'should print valid ip address' do
|
41
|
-
@lan.ip.
|
42
|
+
expect(@lan.ip).to eq('192.168.1.41')
|
42
43
|
end
|
43
44
|
|
44
45
|
it 'should print valid snmp string' do
|
45
|
-
@lan.snmp.
|
46
|
+
expect(@lan.snmp).to be_nil
|
46
47
|
|
47
48
|
end
|
48
49
|
|
49
50
|
it 'should print correct mac address' do
|
50
|
-
@lan.mac.
|
51
|
+
expect(@lan.mac).to eq('00:17:a4:49:ab:70')
|
51
52
|
end
|
52
53
|
|
53
54
|
it 'should print correct netmask' do
|
54
|
-
@lan.netmask.
|
55
|
+
expect(@lan.netmask).to eq('255.255.255.0')
|
55
56
|
end
|
56
57
|
|
57
58
|
it 'should print correct gateway' do
|
58
|
-
@lan.gateway.
|
59
|
+
expect(@lan.gateway).to eq('192.168.1.1')
|
59
60
|
end
|
60
61
|
|
61
62
|
it 'should print vlanid' do
|
62
|
-
@lan.vlanid.
|
63
|
+
expect(@lan.vlanid).to be_nil
|
63
64
|
end
|
64
65
|
|
65
66
|
it 'dhcp should return true' do
|
66
|
-
@lan.dhcp
|
67
|
+
expect(@lan.dhcp?).to eq true
|
67
68
|
end
|
68
69
|
|
69
70
|
it 'static should return false' do
|
70
|
-
@lan.static
|
71
|
+
expect(@lan.static?).to eq false
|
71
72
|
end
|
72
73
|
|
73
74
|
#it 'should attempt to apply fix and fail, then switch to channel 1' do
|
@@ -1,4 +1,5 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
|
+
|
2
3
|
describe :Sensors do
|
3
4
|
before :all do
|
4
5
|
@path = '/usr/local/bin'
|
@@ -12,18 +13,18 @@ describe :Sensors do
|
|
12
13
|
user = "ipmiuser"
|
13
14
|
pass = "impipass"
|
14
15
|
host = "ipmihost"
|
15
|
-
Rubyipmi.
|
16
|
+
allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
|
16
17
|
|
17
18
|
@conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
|
18
19
|
@sensors = @conn.sensors
|
19
20
|
File.open("spec/fixtures/#{provider}/sensors.txt",'r') do |file|
|
20
21
|
data = file.read
|
21
22
|
end
|
22
|
-
@sensors.
|
23
|
-
@sensors.
|
23
|
+
allow(@sensors).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
|
24
|
+
allow(@sensors).to receive(:`).and_return(data)
|
24
25
|
|
25
26
|
# this is causing an error: An expectation of :success? was set on nil
|
26
|
-
|
27
|
+
allow($?).to receive(:success?).and_return(true)
|
27
28
|
|
28
29
|
end
|
29
30
|
|
@@ -40,42 +41,42 @@ describe :Sensors do
|
|
40
41
|
#end
|
41
42
|
|
42
43
|
it "can return a list of sensors" do
|
43
|
-
@sensors.list.
|
44
|
+
expect(@sensors.list).not_to be_nil
|
44
45
|
end
|
45
46
|
|
46
47
|
it "should return a count of sensors" do
|
47
|
-
@sensors.count.
|
48
|
+
expect(@sensors.count).to eq(99)
|
48
49
|
end
|
49
50
|
|
50
51
|
it "should return a list of fan names" do
|
51
|
-
@sensors.fanlist.count.
|
52
|
+
expect(@sensors.fanlist.count).to eq(17)
|
52
53
|
end
|
53
54
|
|
54
55
|
it 'should return a list of temp names' do
|
55
|
-
@sensors.templist.count.
|
56
|
+
expect(@sensors.templist.count).to eq(43)
|
56
57
|
@sensors.templist.each do | temp |
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
61
|
it 'should return a list of sensor names as an array' do
|
61
|
-
@sensors.names.
|
62
|
-
@sensors.names.count.
|
62
|
+
expect(@sensors.names).to be_an_instance_of(Array)
|
63
|
+
expect(@sensors.names.count).to eq(99)
|
63
64
|
end
|
64
65
|
|
65
66
|
it 'should return an empty list if no data exists' do
|
66
|
-
@sensors.
|
67
|
-
@sensors.names.count.
|
67
|
+
allow(@sensors).to receive(:getsensors).and_return(nil)
|
68
|
+
expect(@sensors.names.count).to eq(0)
|
68
69
|
end
|
69
70
|
|
70
71
|
it 'should return a sensor using method missing' do
|
71
72
|
@sensors.names.each do |name|
|
72
73
|
sensor = @sensors.send(name)
|
73
|
-
sensor.
|
74
|
+
expect(sensor).to be_an_instance_of(Rubyipmi::Ipmitool::Sensor)
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|
77
78
|
it "test should create new Sensor" do
|
78
|
-
Rubyipmi::Ipmitool::Sensor.new("fakesensor").
|
79
|
+
expect(Rubyipmi::Ipmitool::Sensor.new("fakesensor")).not_to be nil
|
79
80
|
end
|
80
81
|
|
81
82
|
#it 'fix should be added to options after error occurs' do
|
data/spec/unit/rubyipmi_spec.rb
CHANGED
@@ -8,18 +8,18 @@ describe :Rubyipmi do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'is provider installed should return ipmitool true' do
|
11
|
-
Rubyipmi.
|
12
|
-
Rubyipmi.is_provider_installed?('ipmitool').
|
11
|
+
allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return('/usr/local/bin/ipmitool')
|
12
|
+
expect(Rubyipmi.is_provider_installed?('ipmitool')).to eq true
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'is locate command should return command in /usr/local/bin' do
|
16
|
-
Rubyipmi.
|
17
|
-
Rubyipmi.locate_command('ipmitool').
|
16
|
+
allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return('/usr/local/bin/ipmitool')
|
17
|
+
expect(Rubyipmi.locate_command('ipmitool')).to eq('/usr/local/bin/ipmitool')
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'is provider installed should return freeipmi true' do
|
21
|
-
Rubyipmi.
|
22
|
-
Rubyipmi.is_provider_installed?('freeipmi').
|
21
|
+
allow(Rubyipmi).to receive(:locate_command).with('ipmipower').and_return('/usr/local/bin/ipmipower')
|
22
|
+
expect(Rubyipmi.is_provider_installed?('freeipmi')).to eq true
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'is provider installed should return error with ipmitool' do
|
metadata
CHANGED
@@ -1,97 +1,139 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyipmi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '3.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '3.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.12'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.12'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.1.5
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.1.5
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: jeweler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.0.1
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: highline
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry-rescue
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
95
137
|
- !ruby/object:Gem::Version
|
96
138
|
version: '0'
|
97
139
|
description: Provides a library for controlling IPMI devices using pure ruby code
|
@@ -101,12 +143,10 @@ extensions: []
|
|
101
143
|
extra_rdoc_files:
|
102
144
|
- LICENSE.txt
|
103
145
|
- README.md
|
104
|
-
- README.rdoc
|
105
146
|
files:
|
106
147
|
- Gemfile
|
107
148
|
- LICENSE.txt
|
108
149
|
- README.md
|
109
|
-
- README.rdoc
|
110
150
|
- RELEASE_NOTES.md
|
111
151
|
- Rakefile
|
112
152
|
- VERSION
|
@@ -187,7 +227,7 @@ files:
|
|
187
227
|
- spec/vagrant.pub
|
188
228
|
homepage: http://github.com/logicminds/rubyipmi
|
189
229
|
licenses:
|
190
|
-
-
|
230
|
+
- LGPLv2.1
|
191
231
|
metadata: {}
|
192
232
|
post_install_message:
|
193
233
|
rdoc_options: []
|
@@ -195,17 +235,17 @@ require_paths:
|
|
195
235
|
- lib
|
196
236
|
required_ruby_version: !ruby/object:Gem::Requirement
|
197
237
|
requirements:
|
198
|
-
- -
|
238
|
+
- - ">="
|
199
239
|
- !ruby/object:Gem::Version
|
200
240
|
version: '0'
|
201
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
242
|
requirements:
|
203
|
-
- -
|
243
|
+
- - ">="
|
204
244
|
- !ruby/object:Gem::Version
|
205
245
|
version: '0'
|
206
246
|
requirements: []
|
207
247
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
248
|
+
rubygems_version: 2.4.5
|
209
249
|
signing_key:
|
210
250
|
specification_version: 4
|
211
251
|
summary: A ruby wrapper for ipmi command line tools that supports ipmitool and freeipmi
|
data/README.rdoc
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
= rubyipmi
|
2
|
-
|
3
|
-
|
4
|
-
== Contributing to rubyipmi
|
5
|
-
|
6
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
7
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
8
|
-
* Fork the project.
|
9
|
-
* Start a feature/bugfix branch.
|
10
|
-
* Commit and push until you are happy with your contribution.
|
11
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
12
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
13
|
-
|
14
|
-
== Copyright
|
15
|
-
|
16
|
-
Copyright (c) 2012 Corey Osman. See LICENSE.txt for
|
17
|
-
further details.
|
18
|
-
|