rubyipmi 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +5 -5
  2. data/.document +5 -0
  3. data/.gitignore +50 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +66 -0
  6. data/.travis.yml +13 -0
  7. data/Gemfile +3 -3
  8. data/README.md +9 -3
  9. data/RELEASE_NOTES.md +33 -0
  10. data/Rakefile +15 -42
  11. data/lib/rubyipmi/commands/basecommand.rb +17 -23
  12. data/lib/rubyipmi/commands/mixins/power_mixin.rb +50 -0
  13. data/lib/rubyipmi/commands/mixins/sensors_mixin.rb +54 -0
  14. data/lib/rubyipmi/freeipmi/commands/basecommand.rb +26 -35
  15. data/lib/rubyipmi/freeipmi/commands/bmc.rb +4 -7
  16. data/lib/rubyipmi/freeipmi/commands/bmcconfig.rb +7 -17
  17. data/lib/rubyipmi/freeipmi/commands/bmcdevice.rb +2 -9
  18. data/lib/rubyipmi/freeipmi/commands/bmcinfo.rb +4 -10
  19. data/lib/rubyipmi/freeipmi/commands/chassis.rb +27 -45
  20. data/lib/rubyipmi/freeipmi/commands/chassisconfig.rb +23 -38
  21. data/lib/rubyipmi/freeipmi/commands/fru.rb +23 -42
  22. data/lib/rubyipmi/freeipmi/commands/lan.rb +4 -6
  23. data/lib/rubyipmi/freeipmi/commands/power.rb +8 -51
  24. data/lib/rubyipmi/freeipmi/commands/sensors.rb +10 -67
  25. data/lib/rubyipmi/freeipmi/connection.rb +14 -17
  26. data/lib/rubyipmi/freeipmi/errorcodes.rb +11 -17
  27. data/lib/rubyipmi/ipmitool/commands/basecommand.rb +12 -16
  28. data/lib/rubyipmi/ipmitool/commands/bmc.rb +13 -22
  29. data/lib/rubyipmi/ipmitool/commands/chassis.rb +26 -44
  30. data/lib/rubyipmi/ipmitool/commands/chassisconfig.rb +11 -21
  31. data/lib/rubyipmi/ipmitool/commands/fru.rb +35 -48
  32. data/lib/rubyipmi/ipmitool/commands/lan.rb +25 -28
  33. data/lib/rubyipmi/ipmitool/commands/power.rb +7 -58
  34. data/lib/rubyipmi/ipmitool/commands/sensors.rb +10 -68
  35. data/lib/rubyipmi/ipmitool/connection.rb +10 -19
  36. data/lib/rubyipmi/ipmitool/errorcodes.rb +11 -45
  37. data/lib/rubyipmi/observablehash.rb +1 -2
  38. data/lib/rubyipmi/version.rb +5 -0
  39. data/lib/rubyipmi.rb +23 -28
  40. data/rubyipmi.gemspec +17 -128
  41. metadata +18 -101
  42. data/spec/Vagrantfile +0 -45
  43. data/spec/fixtures/freeipmi/bmc_config.txt +0 -317
  44. data/spec/fixtures/freeipmi/bmc_config_lan_conf.txt +0 -19
  45. data/spec/fixtures/freeipmi/bmc_info.txt +0 -32
  46. data/spec/fixtures/freeipmi/errors.txt +0 -3
  47. data/spec/fixtures/freeipmi/fru.txt +0 -13
  48. data/spec/fixtures/freeipmi/sensors.txt +0 -29
  49. data/spec/fixtures/ipmitool/bmc_info.txt +0 -20
  50. data/spec/fixtures/ipmitool/errors.txt +0 -10
  51. data/spec/fixtures/ipmitool/fru.txt +0 -96
  52. data/spec/fixtures/ipmitool/lan.txt +0 -17
  53. data/spec/fixtures/ipmitool/sensors.txt +0 -105
  54. data/spec/integration/bmc_spec.rb +0 -48
  55. data/spec/integration/chassis_config_spec.rb +0 -38
  56. data/spec/integration/chassis_spec.rb +0 -26
  57. data/spec/integration/connection_spec.rb +0 -45
  58. data/spec/integration/fru_spec.rb +0 -38
  59. data/spec/integration/lan_spec.rb +0 -50
  60. data/spec/integration/power_spec.rb +0 -40
  61. data/spec/integration/rubyipmi_spec.rb +0 -114
  62. data/spec/integration/sensor_spec.rb +0 -43
  63. data/spec/manifests/default.pp +0 -50
  64. data/spec/puppetmodules/archive/LICENSE-2.0.txt +0 -202
  65. data/spec/puppetmodules/archive/Modulefile +0 -8
  66. data/spec/puppetmodules/archive/README.md +0 -40
  67. data/spec/puppetmodules/archive/manifests/download.pp +0 -157
  68. data/spec/puppetmodules/archive/manifests/extract.pp +0 -81
  69. data/spec/puppetmodules/archive/manifests/init.pp +0 -70
  70. data/spec/puppetmodules/archive/manifests/tar-gz.pp +0 -7
  71. data/spec/puppetmodules/archive/manifests/zip.pp +0 -7
  72. data/spec/puppetmodules/archive/metadata.json +0 -26
  73. data/spec/spec_helper.rb +0 -47
  74. data/spec/unit/freeipmi/bmc-info_spec.rb +0 -38
  75. data/spec/unit/freeipmi/bmc_spec.rb +0 -43
  76. data/spec/unit/freeipmi/connection_spec.rb +0 -121
  77. data/spec/unit/freeipmi/errorcodes_spec.rb +0 -28
  78. data/spec/unit/freeipmi/fru_spec.rb +0 -76
  79. data/spec/unit/freeipmi/lan_spec.rb +0 -0
  80. data/spec/unit/freeipmi/sensors_spec.rb +0 -85
  81. data/spec/unit/ipmitool/bmc_spec.rb +0 -77
  82. data/spec/unit/ipmitool/connection_spec.rb +0 -122
  83. data/spec/unit/ipmitool/errorcodes_spec.rb +0 -35
  84. data/spec/unit/ipmitool/fru_spec.rb +0 -77
  85. data/spec/unit/ipmitool/lan_spec.rb +0 -94
  86. data/spec/unit/ipmitool/sensors_spec.rb +0 -96
  87. data/spec/unit/rubyipmi_spec.rb +0 -50
  88. data/spec/vagrant +0 -27
  89. data/spec/vagrant.pub +0 -1
@@ -1,77 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe :Fru do
4
-
5
- before :all do
6
- @path = '/usr/local/bin'
7
- end
8
-
9
- before :each do
10
- allow_message_expectations_on_nil
11
- data = nil
12
- provider = "ipmitool"
13
- user = "ipmiuser"
14
- pass = "impipass"
15
- host = "ipmihost"
16
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
17
-
18
- @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
19
- @fru = @conn.fru
20
-
21
- File.open("spec/fixtures/#{provider}/fru.txt",'r') do |file|
22
- data = file.read
23
- end
24
-
25
- allow(@fru).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
26
- allow(@fru).to receive(:`).and_return(data)
27
- allow($?).to receive(:success?).and_return(true)
28
-
29
- end
30
-
31
- it "cmd should be ipmi-sensors with correct number of arguments" do
32
- @fru.list
33
- verify_ipmitool_command(@fru, 4, "#{@path}/ipmitool", 'fru')
34
- end
35
-
36
- it 'should return a list of unparsed frus' do
37
- expect(@fru.getfrus).not_to be_nil
38
- end
39
-
40
- it 'should return a list of fru names' do
41
- expect(@fru.names.count).to eq(13)
42
- end
43
-
44
- it "should return a list of parsed frus" do
45
- expect(@fru.list.count).to eq(13)
46
- end
47
-
48
- it 'should return a manufactor' do
49
- expect(@fru.product_manufacturer).to eq('HP')
50
- end
51
-
52
- it 'should return a product' do
53
- expect(@fru.product_name).to eq('ProLiant SL230s Gen8')
54
- end
55
-
56
- it 'should return a board serial' do
57
- expect(@fru.board_serial).to eq('USE238F0D0')
58
- end
59
-
60
- it 'should return a product serial' do
61
- expect(@fru.product_serial).to eq('USE238F0D0')
62
- end
63
-
64
- it 'should return a asset tag' do
65
- expect(@fru.product_asset_tag).to eq('000015B90F82')
66
- end
67
-
68
- it 'should return a fru using method missing' do
69
- @fru.names.each do |name|
70
- fru = @fru.send(name)
71
- expect(fru).to be_an_instance_of(Rubyipmi::Ipmitool::FruData)
72
- expect(fru[:name]).to eq(name)
73
- end
74
- end
75
-
76
-
77
- end
@@ -1,94 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Lan" do
4
-
5
- before :all do
6
- @path = '/usr/local/bin'
7
- end
8
-
9
- before :each do
10
- allow_message_expectations_on_nil
11
- provider = "ipmitool"
12
- user = "ipmiuser"
13
- pass = "impipass"
14
- host = "ipmihost"
15
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
16
- @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
17
- @lan = @conn.bmc.lan
18
- data = nil
19
- File.open("spec/fixtures/#{provider}/lan.txt",'r') do |file|
20
- data = file.read
21
- end
22
-
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)
26
- end
27
-
28
- it "cmd should be lan with correct number of arguments" do
29
- @lan.info
30
- verify_ipmitool_command(@lan, 4, "#{@path}/ipmitool", 'lanplus')
31
- end
32
-
33
- it "can return a lan information" do
34
- expect(@lan.info).not_to be_nil
35
- end
36
-
37
- it "can print valid lan info" do
38
- expect(@lan.info.length).to be > 1
39
- end
40
-
41
- it 'should print valid ip address' do
42
- expect(@lan.ip).to eq('192.168.1.41')
43
- end
44
-
45
- it 'should print valid snmp string' do
46
- expect(@lan.snmp).to be_nil
47
-
48
- end
49
-
50
- it 'should print correct mac address' do
51
- expect(@lan.mac).to eq('00:17:a4:49:ab:70')
52
- end
53
-
54
- it 'should print correct netmask' do
55
- expect(@lan.netmask).to eq('255.255.255.0')
56
- end
57
-
58
- it 'should print correct gateway' do
59
- expect(@lan.gateway).to eq('192.168.1.1')
60
- end
61
-
62
- it 'should print vlanid' do
63
- expect(@lan.vlanid).to be_nil
64
- end
65
-
66
- it 'dhcp should return true' do
67
- expect(@lan.dhcp?).to eq true
68
- end
69
-
70
- it 'static should return false' do
71
- expect(@lan.static?).to eq false
72
- end
73
-
74
- #it 'should attempt to apply fix and fail, then switch to channel 1' do
75
- # channelbefore = @lan.channel
76
- # error = "some lan channel problem"
77
- # @lan.stub(:`).and_return(error)
78
- # $?.stub(:success?).and_return(false)
79
- # @lan.ip
80
- # channelbefore = @lan.channel
81
- #
82
- # data = nil
83
- # File.open("spec/fixtures/#{provider}/lan.txt",'r') do |file|
84
- # data = file.read
85
- # end
86
- #
87
- # @lan.stub(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
88
- # @lan.stub(:`).and_return(data)
89
- # $?.stub(:success?).and_return(true)
90
- #
91
- #end
92
-
93
- end
94
-
@@ -1,96 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe :Sensors do
4
- before :all do
5
- @path = '/usr/local/bin'
6
- end
7
-
8
- before :each do
9
- allow_message_expectations_on_nil
10
-
11
- data = nil
12
- provider = "ipmitool"
13
- user = "ipmiuser"
14
- pass = "impipass"
15
- host = "ipmihost"
16
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
17
-
18
- @conn = Rubyipmi.connect(user, pass, host, provider, {:debug => true})
19
- @sensors = @conn.sensors
20
- File.open("spec/fixtures/#{provider}/sensors.txt",'r') do |file|
21
- data = file.read
22
- end
23
- allow(@sensors).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
24
- allow(@sensors).to receive(:`).and_return(data)
25
-
26
- # this is causing an error: An expectation of :success? was set on nil
27
- allow($?).to receive(:success?).and_return(true)
28
-
29
- end
30
-
31
- #it 'should figure out to add the -I lanplus' do
32
- # error = 'Authentication type NONE not supported'
33
- # @sensors.stub(:`).and_return(error)
34
- # @sensors.list
35
- # @sensors.lastcall.includes?('-I lanplus')
36
- #end
37
-
38
- #it "cmd should be ipmi-sensors with three arguments" do
39
- # @sensors.list
40
- # verify_ipmitool_command(@sensors, 3, "#{@path}/ipmitool", 'sensor')
41
- #end
42
-
43
- it "can return a list of sensors" do
44
- expect(@sensors.list).not_to be_nil
45
- end
46
-
47
- it "should return a count of sensors" do
48
- expect(@sensors.count).to eq(99)
49
- end
50
-
51
- it "should return a list of fan names" do
52
- expect(@sensors.fanlist.count).to eq(17)
53
- end
54
-
55
- it 'should return a list of temp names' do
56
- expect(@sensors.templist.count).to eq(43)
57
- @sensors.templist.each do | temp |
58
- end
59
- end
60
-
61
- it 'should return a list of sensor names as an array' do
62
- expect(@sensors.names).to be_an_instance_of(Array)
63
- expect(@sensors.names.count).to eq(99)
64
- end
65
-
66
- it 'should return an empty list if no data exists' do
67
- allow(@sensors).to receive(:getsensors).and_return(nil)
68
- expect(@sensors.names.count).to eq(0)
69
- end
70
-
71
- it 'should return a sensor using method missing' do
72
- @sensors.names.each do |name|
73
- sensor = @sensors.send(name)
74
- expect(sensor).to be_an_instance_of(Rubyipmi::Ipmitool::Sensor)
75
- end
76
- end
77
-
78
- it "test should create new Sensor" do
79
- expect(Rubyipmi::Ipmitool::Sensor.new("fakesensor")).not_to be nil
80
- end
81
-
82
- #it 'fix should be added to options after error occurs' do
83
- # error = nil
84
- # File.open("spec/fixtures/ipmitool/errors.txt",'r') do |file|
85
- # error = file.read
86
- # end
87
- # @sensors.stub(:`).and_return(error)
88
- # $?.stub(:success?).and_return(false)
89
- # @sensors.list
90
- # after = @sensors.options.fetch('I', false).should_not be_false
91
- #end
92
-
93
-
94
-
95
- end
96
-
@@ -1,50 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
-
3
- describe :Rubyipmi do
4
-
5
-
6
- before :each do
7
-
8
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return("#{@path}/ipmitool")
9
- end
10
-
11
- it 'is provider installed should return ipmitool true' do
12
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return('/usr/local/bin/ipmitool')
13
- expect(Rubyipmi.is_provider_installed?('ipmitool')).to eq true
14
- end
15
-
16
- it 'is locate command should return command in /usr/local/bin' do
17
- allow(Rubyipmi).to receive(:locate_command).with('ipmitool').and_return('/usr/local/bin/ipmitool')
18
- expect(Rubyipmi.locate_command('ipmitool')).to eq('/usr/local/bin/ipmitool')
19
- end
20
-
21
- it 'is provider installed should return freeipmi true' do
22
- allow(Rubyipmi).to receive(:locate_command).with('ipmipower').and_return('/usr/local/bin/ipmipower')
23
- expect(Rubyipmi.is_provider_installed?('freeipmi')).to eq true
24
- end
25
-
26
- it 'is provider installed should return false when bad provider' do
27
- expect{Rubyipmi.is_provider_installed?('bad_provider')}.to_not raise_error
28
- expect(Rubyipmi.is_provider_installed?('bad_provider')).to be_falsey
29
- end
30
-
31
- it 'converts string to symbols' do
32
- user = "ipmiuser"
33
- pass = "impipass"
34
- host = "ipmihost"
35
- provider = "ipmitool"
36
- conn = Rubyipmi.connect(user, pass, host, provider, {'driver' => 'lan15'})
37
- expect(conn.options).to eq({"H"=>"ipmihost", "U"=>"ipmiuser", "P"=>"impipass", "I"=>"lan"})
38
- end
39
-
40
- it 'does not error when converting strings to symbols' do
41
- user = "ipmiuser"
42
- pass = "impipass"
43
- host = "ipmihost"
44
- provider = "ipmitool"
45
- conn = Rubyipmi.connect(user, pass, host, provider, {:driver => 'lan15'})
46
- expect(conn.options).to eq({"H"=>"ipmihost", "U"=>"ipmiuser", "P"=>"impipass", "I"=>"lan"})
47
- end
48
- end
49
-
50
-
data/spec/vagrant DELETED
@@ -1,27 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIIEogIBAAKCAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzI
3
- w+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoP
4
- kcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2
5
- hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NO
6
- Td0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcW
7
- yLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQIBIwKCAQEA4iqWPJXtzZA68mKd
8
- ELs4jJsdyky+ewdZeNds5tjcnHU5zUYE25K+ffJED9qUWICcLZDc81TGWjHyAqD1
9
- Bw7XpgUwFgeUJwUlzQurAv+/ySnxiwuaGJfhFM1CaQHzfXphgVml+fZUvnJUTvzf
10
- TK2Lg6EdbUE9TarUlBf/xPfuEhMSlIE5keb/Zz3/LUlRg8yDqz5w+QWVJ4utnKnK
11
- iqwZN0mwpwU7YSyJhlT4YV1F3n4YjLswM5wJs2oqm0jssQu/BT0tyEXNDYBLEF4A
12
- sClaWuSJ2kjq7KhrrYXzagqhnSei9ODYFShJu8UWVec3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WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key