lab-manager 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/lab_manager.rb CHANGED
@@ -19,6 +19,12 @@ require 'lab_manager/httpclient_patch'
19
19
  #
20
20
  class LabManager
21
21
 
22
+ @@DEBUG = 0
23
+
24
+ def self.DEBUG=(value)
25
+ @@DEBUG = value
26
+ end
27
+
22
28
  @@configPath = File.expand_path("~/.lab_manager")
23
29
  @@url = nil
24
30
 
@@ -108,7 +114,7 @@ class LabManager
108
114
 
109
115
  data = proxy.ListMachines(:configurationId => configurationId)
110
116
 
111
- machines = Machine.fromList(data)
117
+ machines = Machine.from_list(data)
112
118
 
113
119
  if (!options[:exclude].nil?)
114
120
  machines = machines.find_all { |machine|
@@ -129,7 +135,7 @@ class LabManager
129
135
  def proxy
130
136
  factory = SOAP::WSDLDriverFactory.new("#{@@url}?WSDL")
131
137
  proxy = factory.create_rpc_driver
132
- #proxy.wiredump_dev = STDOUT
138
+ proxy.wiredump_dev = STDOUT if DEBUG
133
139
  proxy.generate_explicit_type = false # No datatype with request
134
140
  proxy.headerhandler << LabManagerHeader.new(@organization, @workspace, @username, @password)
135
141
 
@@ -1,13 +1,18 @@
1
1
  class Machine
2
2
 
3
- def self.fromList(data)
3
+ def self.from_list(data)
4
4
  return [] if data.nil?
5
5
  return [] if data["ListMachinesResult"].nil?
6
6
  return [] if data["ListMachinesResult"]["Machine"].nil?
7
7
 
8
- data["ListMachinesResult"]["Machine"].collect { |machine|
9
- Machine.new(machine)
10
- }
8
+ machine_list = data["ListMachinesResult"]["Machine"]
9
+ if (machine_list.is_a? Array)
10
+ machine_list.collect { |machine|
11
+ Machine.new(machine)
12
+ }
13
+ else
14
+ [Machine.new(machine_list)]
15
+ end
11
16
  end
12
17
 
13
18
  def self.to_csv(machines)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lab-manager
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 5
10
- version: 1.0.5
9
+ - 6
10
+ version: 1.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ed Sumerfield