moob 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/bin/moob CHANGED
@@ -7,7 +7,7 @@ options = {
7
7
  :actions => [:jnlp],
8
8
  :type => :auto,
9
9
  :machines => [],
10
- :password => ENV['password']
10
+ :password => ENV['PASSWORD']
11
11
  }
12
12
 
13
13
  OptionParser.new do |opts|
data/lib/moob.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Moob
2
- VERSION = [0,3,1]
2
+ VERSION = [0,3,2]
3
3
 
4
4
  class ResponseError < Exception
5
5
  def initialize response
@@ -35,7 +35,7 @@ module Moob
35
35
  end
36
36
  false
37
37
  end
38
- raise RuntimeError.new "Couldn't detect a known LOM type"
38
+ raise "Couldn't detect a known LOM type"
39
39
  else
40
40
  return TYPES[type].new hostname, options
41
41
  end
@@ -45,7 +45,7 @@ module Moob
45
45
  jnlp = lom.jnlp
46
46
 
47
47
  unless jnlp[/<\/jnlp>/]
48
- raise RuntimeError.new "Invalid JNLP file (\"#{jnlp}\")"
48
+ raise "Invalid JNLP file (\"#{jnlp}\")"
49
49
  end
50
50
 
51
51
  filepath = "/tmp/#{lom.hostname}_#{Time.now.to_i}.jnlp"
@@ -53,7 +53,7 @@ module Moob
53
53
  f.write jnlp
54
54
  end
55
55
 
56
- raise Exception.new "javaws failed" unless system "javaws -wait #{filepath}"
56
+ raise "javaws failed" unless system "javaws -wait #{filepath}"
57
57
  end
58
58
 
59
59
  def self.inform msg
data/lib/moob/idrac6.rb CHANGED
@@ -84,8 +84,8 @@ class Idrac6 < BaseLom
84
84
  raise ResponseError.new auth unless auth.status == 200
85
85
 
86
86
  auth.body =~ /<authResult>([^<]+)<\/authResult>/
87
- raise Exception.new 'Cannot find auth result' unless $&
88
- raise Exception.new "Auth failed with: \"#{auth.body}\"" unless $1 == "0"
87
+ raise 'Cannot find auth result' unless $&
88
+ raise "Auth failed with: \"#{auth.body}\"" unless $1 == "0"
89
89
  return self
90
90
  end
91
91
 
@@ -110,11 +110,11 @@ class Idrac6 < BaseLom
110
110
  raise ResponseError.new idx unless idx.status == 200
111
111
 
112
112
  idx.body =~ /var DnsName += +"([^"]+)"/
113
- raise Exception.new "Couldn't find the DNS name" unless $&
113
+ raise "Couldn't find the DNS name" unless $&
114
114
  dns_name = $1
115
115
 
116
116
  idx.body =~ /var sysNameStr += +"([^"]+)"/
117
- raise Exception.new "Couldn't find the system name" unless $&
117
+ raise "Couldn't find the system name" unless $&
118
118
  sys_name = $1 # eg PowerEdge R610
119
119
 
120
120
  # eg escaped "idrac-A1BCD2E, PowerEdge R610, User:root"
@@ -188,7 +188,7 @@ class Idrac6 < BaseLom
188
188
  infos = @session.post "data?get=#{keys.join(',')}", {}
189
189
 
190
190
  raise ResponseError.new infos unless infos.status == 200
191
- raise Exception.new "The status isn't OK" unless infos.body =~ /<status>ok<\/status>/
191
+ raise "The status isn't OK" unless infos.body =~ /<status>ok<\/status>/
192
192
 
193
193
  return Hash[keys.collect do |k|
194
194
  if infos.body =~ /<#{k}>(.*?)<\/#{k}>/
@@ -9,7 +9,7 @@ class Megatrends < BaseLom
9
9
  begin
10
10
  @ip = Socket.getaddrinfo(hostname, nil)[0][3]
11
11
  rescue
12
- raise Exception.new "Couldn't resolve \"#{hostname}\""
12
+ raise "Couldn't resolve \"#{hostname}\""
13
13
  end
14
14
  @session.base_url = "https://#{@ip}/"
15
15
  end
@@ -21,7 +21,7 @@ class Megatrends < BaseLom
21
21
  raise ResponseError.new auth unless auth.status == 200
22
22
 
23
23
  auth.body =~ /'SESSION_COOKIE' *: *'([^']+)'/
24
- raise Exception.new "Couldn't find auth cookie in \"#{auth.body}\"" unless $&
24
+ raise "Couldn't find auth cookie in \"#{auth.body}\"" unless $&
25
25
 
26
26
  @cookie = "test=1; path=/; SessionCookie=#{$1}"
27
27
  return self
@@ -51,7 +51,7 @@ class Megatrends < BaseLom
51
51
  { 'Cookie' => @cookie }
52
52
  raise ResponseError.new req unless req.status == 200
53
53
  unless req.body =~ /WEBVAR_STRUCTNAME_HL_POWERSTATUS/
54
- raise Exception.new 'The answer looks wrong'
54
+ raise 'The answer looks wrong'
55
55
  end
56
56
  return nil
57
57
  end
@@ -72,7 +72,7 @@ class Megatrends < BaseLom
72
72
  status = @session.get 'rpc/hoststatus.asp',
73
73
  { 'Cookie' => @cookie }
74
74
  raise ResponseError.new status unless status.status == 200
75
- raise Exception.new 'Couldn\'t read the state' unless status.body =~ /'JF_STATE' : (.),/
75
+ raise 'Couldn\'t read the state' unless status.body =~ /'JF_STATE' : (.),/
76
76
  case $1
77
77
  when '0'
78
78
  return :off
data/lib/moob/sunilom.rb CHANGED
@@ -23,11 +23,11 @@ class SunILom < BaseLom
23
23
  error = "\"#{$1.gsub /<[^>]+>/, ''}\""
24
24
  end
25
25
 
26
- raise Exception.new "Auth failed (#{error})"
26
+ raise "Auth failed (#{error})"
27
27
  end
28
28
 
29
29
  auth.body =~ /SetWebSessionString\("([^"]+)","([^"]+)"\);/
30
- raise Exception.new "Couldn't find session cookie in \"#{auth.body}\"" unless $&
30
+ raise "Couldn't find session cookie in \"#{auth.body}\"" unless $&
31
31
 
32
32
  @cookie = "#{$1}=#{$2}; langsetting=EN"
33
33
  return self
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pierre Carrier
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-02-23 00:00:00 +00:00
17
+ date: 2012-03-12 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency