esx 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/esx.rb +22 -3
  2. metadata +22 -22
data/lib/esx.rb CHANGED
@@ -6,7 +6,7 @@ require 'net/ssh'
6
6
 
7
7
  module ESX
8
8
 
9
- VERSION = '0.2.3'
9
+ VERSION = '0.2.4'
10
10
 
11
11
  class Host
12
12
 
@@ -92,6 +92,9 @@ module ESX
92
92
  # :disk_type => flat, sparse (default flat)
93
93
  # }
94
94
  #
95
+ # supported guest_id list:
96
+ # http://pubs.vmware.com/vsphere-50/index.jsp?topic=/com.vmware.wssdk.apiref.doc_50/vim.vm.GuestOsDescriptor.GuestOsIdentifier.html
97
+ #
95
98
  # Default values above.
96
99
  def create_vm(specification)
97
100
  spec = specification
@@ -355,24 +358,40 @@ module ESX
355
358
  guest_info.ip_address
356
359
  end
357
360
 
361
+ def nics
362
+ list = []
363
+ vm_object.config.hardware.device.grep(RbVmomi::VIM::VirtualEthernetCard).each do |n|
364
+ list << NetworkInterface.wrap(n)
365
+ end
366
+ list
367
+ end
368
+
358
369
  end
359
370
 
360
371
  class NetworkInterface
361
372
 
362
373
  attr_accessor :_wrapped_object
363
374
 
375
+ # Accepts VirtualEthernetCard and GuestNicInfo objects
364
376
  def self.wrap(obj)
365
377
  ni = NetworkInterface.new
366
378
  ni._wrapped_object = obj
367
379
  ni
368
380
  end
369
381
 
382
+ # returns nil if the NetworkInterface is of type VirtualEthernetCard
383
+ # returns the IP address if VMWare tools installed in guest and _wrapped_object is of
384
+ # type GuestNicInfo
370
385
  def ip_address
371
- _wrapped_object.ipAddress.first
386
+ if _wrapped_object.is_a? RbVmomi::VIM::VirtualEthernetCard
387
+ nil
388
+ else
389
+ _wrapped_object.ipAddress.first
390
+ end
372
391
  end
373
392
 
374
393
  def mac
375
- _wrapped_object.ipAddress.last
394
+ _wrapped_object.macAddress
376
395
  end
377
396
 
378
397
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-21 00:00:00.000000000 Z
12
+ date: 2011-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &15484180 !ruby/object:Gem::Requirement
16
+ requirement: &11459820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *15484180
24
+ version_requirements: *11459820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &15481960 !ruby/object:Gem::Requirement
27
+ requirement: &11457160 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *15481960
35
+ version_requirements: *11457160
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: jeweler
38
- requirement: &15495640 !ruby/object:Gem::Requirement
38
+ requirement: &11469480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *15495640
46
+ version_requirements: *11469480
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: simplecov
49
- requirement: &15492220 !ruby/object:Gem::Requirement
49
+ requirement: &11467120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *15492220
57
+ version_requirements: *11467120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: alchemist
60
- requirement: &15503640 !ruby/object:Gem::Requirement
60
+ requirement: &11497120 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *15503640
68
+ version_requirements: *11497120
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rbvmomi
71
- requirement: &15498460 !ruby/object:Gem::Requirement
71
+ requirement: &11493140 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *15498460
79
+ version_requirements: *11493140
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: terminal-table
82
- requirement: &15511560 !ruby/object:Gem::Requirement
82
+ requirement: &11584320 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *15511560
90
+ version_requirements: *11584320
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: net-ssh
93
- requirement: &15510000 !ruby/object:Gem::Requirement
93
+ requirement: &11582280 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *15510000
101
+ version_requirements: *11582280
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: net-scp
104
- requirement: &15508740 !ruby/object:Gem::Requirement
104
+ requirement: &11580560 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *15508740
112
+ version_requirements: *11580560
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: clamp
115
- requirement: &15507180 !ruby/object:Gem::Requirement
115
+ requirement: &11578480 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *15507180
123
+ version_requirements: *11578480
124
124
  description: Manage VMWare ESX hosts with ease
125
125
  email: rubiojr@frameos.org
126
126
  executables: