moob 0.4.1 → 0.5.0.pre.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/bin/moob +3 -0
- data/lib/moob.rb +4 -2
- data/lib/moob/idrac6.rb +3 -1
- data/lib/moob/idrac7.rb +6 -2
- data/lib/moob/idrac8.rb +4 -2
- data/lib/moob/idracxml.rb +81 -0
- data/lib/moob/version.rb +1 -1
- metadata +34 -7
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MjZmOGY3MDI4ZjBkMGU2NDQ4NjIzMjNjMTIzZDA0MmVlZWQ3ODlkMg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MjM4Yzc5OTQ5MGYzNmFhYjI5ZmM0NjRjODQ0MjhlMTk5NTJjMjNhNw==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTAzMDBmMzcyZTUwOGY3YjNiZTZlMWMwODhjYzUwZGM0YzczOTVkNDZmNGE5
|
10
|
+
MDY4ZjdjNjAzZTIxMzVmZjFmMTA2MzYwYzk5Y2VhNDc2YmJlNDM1MzEyODVl
|
11
|
+
NWJjNGFmNGVkNGQyMWM5YzU4Y2Q3MjljODQyYTJlMGM0ZTYzNmQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTA2YTg5NTZhNjE4ZTQwZGY3MWNmZjUyYmE2OGEzMTI2OTY2ZTZjMjdhZThl
|
14
|
+
MGEzZTg1MzM1MmM4NDk2ODJlMzQyMThkMmI4YTVhNGU0MWVmMzI1N2RiM2Vk
|
15
|
+
ZWZiODA1N2ExZjA3MGI2ZTE3YTE1YjVjMTc3OWFkM2JjZjcxODY=
|
data/bin/moob
CHANGED
@@ -50,6 +50,9 @@ OptionParser.new do |opts|
|
|
50
50
|
options[:params]=a.inject({}) { |r, i| s=i.split('='); r[s[0]]=s[1]; r}
|
51
51
|
end
|
52
52
|
|
53
|
+
opts.on '-g', '--arg "racadm help"', String, 'Arguments for exec action' do |a|
|
54
|
+
options[:arg] = a
|
55
|
+
end
|
53
56
|
|
54
57
|
opts.on '-u', '--username u',
|
55
58
|
'LOM username',
|
data/lib/moob.rb
CHANGED
@@ -17,6 +17,7 @@ module Moob
|
|
17
17
|
autoload :Idrac6, 'moob/idrac6.rb'
|
18
18
|
autoload :Idrac7, 'moob/idrac7.rb'
|
19
19
|
autoload :Idrac8, 'moob/idrac8.rb'
|
20
|
+
autoload :IdracXml, 'moob/idracxml.rb'
|
20
21
|
autoload :Pec, 'moob/pec.rb'
|
21
22
|
autoload :Megatrends, 'moob/megatrends.rb'
|
22
23
|
autoload :SunILom, 'moob/sunilom.rb'
|
@@ -27,6 +28,7 @@ module Moob
|
|
27
28
|
:idrac6 => Idrac6,
|
28
29
|
:idrac7 => Idrac7,
|
29
30
|
:idrac8 => Idrac8,
|
31
|
+
:idracxml => IdracXml,
|
30
32
|
:pec => Pec,
|
31
33
|
:megatrends => Megatrends,
|
32
34
|
:sun => SunILom,
|
@@ -82,8 +84,8 @@ module Moob
|
|
82
84
|
def self.save_console_preview lom
|
83
85
|
imgfile, headers = lom.fetch_console_preview
|
84
86
|
|
85
|
-
timestamp=Time.parse(headers['Last-modified'])
|
86
|
-
fileext=headers['Content-type'].split('/')[1]
|
87
|
+
timestamp=Time.parse(headers['Last-modified'] || headers['Last-Modified'])
|
88
|
+
fileext=(headers['Content-type'] || headers['Content-Type']).split('/')[1]
|
87
89
|
|
88
90
|
filename="#{lom.hostname}-#{timestamp.utc.iso8601(0)}.#{fileext}"
|
89
91
|
|
data/lib/moob/idrac6.rb
CHANGED
@@ -188,7 +188,9 @@ class Idrac6 < BaseLom
|
|
188
188
|
req = @session.get_file "capconsole/scapture0.png?#{Time.now.utc.to_i}", imgfile.path
|
189
189
|
|
190
190
|
raise ResponseError.new req unless req.status == 200
|
191
|
-
|
191
|
+
|
192
|
+
content_type = req.headers['Content-type'] || req.headers['Content-Type']
|
193
|
+
raise "Unexpected content type #{content_type}, expected 'image/' prefix" unless content_type =~ /image\//
|
192
194
|
|
193
195
|
return imgfile, req.headers
|
194
196
|
end
|
data/lib/moob/idrac7.rb
CHANGED
@@ -32,6 +32,8 @@ class Idrac7 < BaseLom
|
|
32
32
|
@session.handle_cookies nil
|
33
33
|
# Needed for new version of iDrac emb web server to even responde
|
34
34
|
@session.headers['Accept-Language'] = 'en-US,en;q=0.8,sv;q=0.6'
|
35
|
+
# idrac7 responds with a 404 if the request is sent for html is sent without encoding headers
|
36
|
+
@session.headers['Accept-Encoding'] = 'gzip,deflate,sdch'
|
35
37
|
|
36
38
|
login = @session.get 'login.html'
|
37
39
|
|
@@ -56,7 +58,7 @@ class Idrac7 < BaseLom
|
|
56
58
|
|
57
59
|
if @indexurl =~ /defaultCred/
|
58
60
|
@indexurl.gsub!(/defaultCred/,'index')
|
59
|
-
Moob.
|
61
|
+
Moob.inform "iDRAC recommends you should change the default credentials!"
|
60
62
|
end
|
61
63
|
|
62
64
|
Moob.inform "Requesting indexurl of #{@indexurl}"
|
@@ -223,7 +225,9 @@ class Idrac7 < BaseLom
|
|
223
225
|
req = @session.get_file "capconsole/scapture0.png?#{Time.now.utc.to_i}", imgfile.path
|
224
226
|
|
225
227
|
raise ResponseError.new req unless req.status == 200
|
226
|
-
|
228
|
+
|
229
|
+
content_type = req.headers['Content-type'] || req.headers['Content-Type']
|
230
|
+
raise "Unexpected content type #{content_type}, expected 'image/' prefix" unless content_type =~ /image\//
|
227
231
|
|
228
232
|
return imgfile, req.headers
|
229
233
|
end
|
data/lib/moob/idrac8.rb
CHANGED
@@ -63,7 +63,7 @@ class Idrac8 < BaseLom
|
|
63
63
|
|
64
64
|
if @indexurl =~ /defaultCred/
|
65
65
|
@indexurl.gsub!(/defaultCred/,'index')
|
66
|
-
Moob.
|
66
|
+
Moob.inform "iDRAC recommends you should change the default credentials!"
|
67
67
|
end
|
68
68
|
|
69
69
|
Moob.inform "Requesting indexurl of #{@indexurl}"
|
@@ -242,7 +242,9 @@ class Idrac8 < BaseLom
|
|
242
242
|
req = @session.get_file "capconsole/scapture0.png?#{Time.now.utc.to_i}", imgfile.path
|
243
243
|
|
244
244
|
raise ResponseError.new req unless req.status == 200
|
245
|
-
|
245
|
+
|
246
|
+
content_type = req.headers['Content-type'] || req.headers['Content-Type']
|
247
|
+
raise "Unexpected content type #{content_type}, expected 'image/' prefix" unless content_type =~ /image\//
|
246
248
|
|
247
249
|
return imgfile, req.headers
|
248
250
|
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
|
3
|
+
module Moob
|
4
|
+
class IdracXml < BaseLom
|
5
|
+
@name = 'Dell iDrac XML'
|
6
|
+
|
7
|
+
def initialize hostname, options = {}
|
8
|
+
super hostname, options
|
9
|
+
@username ||= 'root'
|
10
|
+
@password ||= 'calvin'
|
11
|
+
@arg = options[:arg]
|
12
|
+
|
13
|
+
discover
|
14
|
+
end
|
15
|
+
|
16
|
+
def xml_request method, uri, data
|
17
|
+
out = @session.send(method, uri, data)
|
18
|
+
|
19
|
+
raise ResponseError.new out unless out.status == 200
|
20
|
+
|
21
|
+
out_xml = Nokogiri::XML(out.body)
|
22
|
+
raise "Cannot parse XML response for request to #{uri}" unless out_xml
|
23
|
+
|
24
|
+
resp_xml = out_xml.xpath("//RESP")
|
25
|
+
raise "Cannot find response XML node in response to #{uri}" unless resp_xml
|
26
|
+
|
27
|
+
resp = {}
|
28
|
+
resp[:body] = out.body
|
29
|
+
resp[:parsed_xml] = {}
|
30
|
+
|
31
|
+
resp_xml.children.each do |n|
|
32
|
+
resp[:parsed_xml][n.name] = n.content
|
33
|
+
end
|
34
|
+
if resp[:parsed_xml].include?('RC')
|
35
|
+
resp[:rc] = Integer(resp[:parsed_xml]['RC'])
|
36
|
+
if resp[:rc] != 0
|
37
|
+
Moob.warn "Return code from #{uri} is #{resp[:rc]}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
return resp
|
42
|
+
end
|
43
|
+
|
44
|
+
def authenticate
|
45
|
+
@session.handle_cookies nil
|
46
|
+
resp = xml_request 'post', 'cgi-bin/login',
|
47
|
+
"<?xml version='1.0'?><LOGIN><REQ><USERNAME>#{@username}</USERNAME><PASSWORD>#{@password}</PASSWORD></REQ></LOGIN>"
|
48
|
+
|
49
|
+
raise "Auth failed with: \"#{resp[:body]}\"" unless resp[:rc] == 0
|
50
|
+
raise "Session ID missing from response" unless resp[:parsed_xml].include?('SID')
|
51
|
+
|
52
|
+
@sid = resp[:parsed_xml]['SID']
|
53
|
+
@session.headers['Cookie'] = "sid=#{@sid}"
|
54
|
+
return self
|
55
|
+
end
|
56
|
+
|
57
|
+
def discover
|
58
|
+
resp = xml_request 'get', 'cgi-bin/discover', {}
|
59
|
+
|
60
|
+
raise "Unsupported iDRAC" unless resp[:parsed_xml]['ENDPOINTTYPE'] =~ /^iDRAC[7-8]?$/
|
61
|
+
raise "Unsupported iDRAC subversion" unless resp[:parsed_xml]['ENDPOINTVER'] == '1.00'
|
62
|
+
raise "Unsupported protocol type" unless resp[:parsed_xml]['PROTOCOLTYPE'] == 'HTTPS'
|
63
|
+
raise "Unsupported protocol version" unless resp[:parsed_xml]['PROTOCOLVER'] == '2.0'
|
64
|
+
end
|
65
|
+
|
66
|
+
def logout
|
67
|
+
out = xml_request 'get', 'cgi-bin/logout', {}
|
68
|
+
return self
|
69
|
+
end
|
70
|
+
|
71
|
+
action :exec, 'Execute a command'
|
72
|
+
def exec
|
73
|
+
out = xml_request 'post', '/cgi-bin/exec',
|
74
|
+
"<?xml version='1.0'?><EXEC><REQ><CMDINPUT>#{@arg}</CMDINPUT><MAXOUTPUTLEN>0x0fff</MAXOUTPUTLEN></REQ></EXEC>"
|
75
|
+
|
76
|
+
puts out[:parsed_xml]['CMDOUTPUT']
|
77
|
+
return nil
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
data/lib/moob/version.rb
CHANGED
metadata
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0.pre.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Ferch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: patron
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.4'
|
20
|
+
- - ! '>='
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 0.4.14
|
20
23
|
type: :runtime
|
@@ -22,6 +25,9 @@ dependencies:
|
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.4'
|
30
|
+
- - ! '>='
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 0.4.14
|
27
33
|
- !ruby/object:Gem::Dependency
|
@@ -29,6 +35,9 @@ dependencies:
|
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.5'
|
40
|
+
- - ! '>='
|
32
41
|
- !ruby/object:Gem::Version
|
33
42
|
version: 1.5.3
|
34
43
|
type: :runtime
|
@@ -36,8 +45,25 @@ dependencies:
|
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
47
|
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.5'
|
50
|
+
- - ! '>='
|
39
51
|
- !ruby/object:Gem::Version
|
40
52
|
version: 1.5.3
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: nokogiri
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
41
67
|
description: Control systems using Web-based out-of-band managers without a browser
|
42
68
|
email:
|
43
69
|
- nf@spotify.com
|
@@ -46,19 +72,20 @@ executables:
|
|
46
72
|
extensions: []
|
47
73
|
extra_rdoc_files: []
|
48
74
|
files:
|
75
|
+
- COPYING
|
49
76
|
- bin/moob
|
77
|
+
- lib/moob.rb
|
50
78
|
- lib/moob/baselom.rb
|
51
79
|
- lib/moob/ibmeserver.rb
|
52
80
|
- lib/moob/idrac6.rb
|
53
81
|
- lib/moob/idrac7.rb
|
54
82
|
- lib/moob/idrac8.rb
|
83
|
+
- lib/moob/idracxml.rb
|
55
84
|
- lib/moob/megatrends.rb
|
56
85
|
- lib/moob/pec.rb
|
57
86
|
- lib/moob/sunilom.rb
|
58
87
|
- lib/moob/supermicro.rb
|
59
88
|
- lib/moob/version.rb
|
60
|
-
- lib/moob.rb
|
61
|
-
- COPYING
|
62
89
|
homepage: https://github.com/spotify/moob
|
63
90
|
licenses:
|
64
91
|
- ISC
|
@@ -69,17 +96,17 @@ require_paths:
|
|
69
96
|
- lib
|
70
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
98
|
requirements:
|
72
|
-
- - '>='
|
99
|
+
- - ! '>='
|
73
100
|
- !ruby/object:Gem::Version
|
74
101
|
version: '0'
|
75
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
103
|
requirements:
|
77
|
-
- - '>='
|
104
|
+
- - ! '>='
|
78
105
|
- !ruby/object:Gem::Version
|
79
106
|
version: 1.2.0
|
80
107
|
requirements: []
|
81
108
|
rubyforge_project: moob
|
82
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.4.5
|
83
110
|
signing_key:
|
84
111
|
specification_version: 4
|
85
112
|
summary: Manage Out-Of-Band!
|