bosh_vcloud_cpi 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0c608586130394ee017d5d2eb63700ce63826aef
4
+ data.tar.gz: 5168386f10ca6b36060da0001a1f8363c37ecb2c
5
+ SHA512:
6
+ metadata.gz: 05c93554f01ed00e7128a515da7ad005cc6a6faa3c1d4026b2e2f6fb2849ff4b2b9dc7d38be3a1119ba0593f84b462429554cc7cd083ba906ff0d94e467960d1
7
+ data.tar.gz: 3cb633a4b8a91a0ebc25850b43d493df15fd35c8597bf4af74e1e49ef0d9acc0f7e393deee8c65f0375d7e790d8f545e3b90f4fef34c090a313ed8f59a33cd8f
@@ -183,27 +183,21 @@ module VCloudSdk
183
183
  parent.add_child(child.node)
184
184
  elsif child.is_a? String
185
185
  node = Nokogiri::XML::Node.new(child, parent)
186
- if (namespace_prefix.nil? ^ namespace_href.nil?)
187
- raise Bosh::Clouds::CpiError,
188
- "Namespace prefix must both be nil or defined together."
189
- end
190
- # This is a little more cumbersome but Nokogiri has problems
191
- # figuring out the right namespace prefix otherwise
192
- if namespace_prefix
193
- ns = node.add_namespace_definition(namespace_prefix,
194
- namespace_href)
195
- node.namespace = ns
196
- end
186
+ set_namespace(node, namespace_prefix, namespace_href)
197
187
  parent.add_child(node)
198
188
  else
199
- raise Bosh::Clouds::CpiError, "Cannot add child. Unknown object passed in."
189
+ fail Bosh::Clouds::CpiError, "Cannot add child. Unknown object passed in."
200
190
  end
201
191
  end
202
192
 
203
193
  # Creates a child node but does not add it to the document. Used when
204
194
  # a new child node has to be in a specific location or order.
205
- def create_child(tag)
206
- Nokogiri::XML::Node.new(tag, @root)
195
+ def create_child(tag,
196
+ namespace_prefix = nil,
197
+ namespace_href = nil)
198
+ node = Nokogiri::XML::Node.new(tag, @root)
199
+ set_namespace(node, namespace_prefix, namespace_href)
200
+ node
207
201
  end
208
202
 
209
203
  protected
@@ -247,6 +241,25 @@ module VCloudSdk
247
241
  clone.namespace = default_ns
248
242
  clone
249
243
  end
244
+
245
+ def set_namespace(node, namespace_prefix, namespace_href)
246
+ if namespace_prefix.nil? && namespace_href.nil?
247
+ return
248
+ elsif namespace_prefix.nil? || namespace_href.nil?
249
+ fail Bosh::Clouds::CpiError,
250
+ "Namespace prefix must both be nil or defined together."
251
+ end
252
+
253
+ if !node.namespace.nil? &&
254
+ node.namespace.prefix == namespace_prefix &&
255
+ node.namespace.href == namespace_href
256
+ return
257
+ end
258
+
259
+ ns = node.add_namespace_definition(namespace_prefix,
260
+ namespace_href)
261
+ node.namespace = ns
262
+ end
250
263
  end
251
264
 
252
265
  end
@@ -42,18 +42,32 @@ module VCloudSdk
42
42
  @local_exists = true
43
43
 
44
44
  locality.each do |k,v|
45
- node_sp = create_child("SourcedVmInstantiationParams")
45
+ node_sp = create_child("SourcedVmInstantiationParams",
46
+ namespace.prefix,
47
+ namespace.href)
48
+
46
49
  is_source_delete.node.after(node_sp)
47
50
 
48
- node_sv = add_child("Source", nil, nil, node_sp)
51
+ node_sv = add_child("Source",
52
+ namespace.prefix,
53
+ namespace.href,
54
+ node_sp)
55
+
49
56
  node_sv["type"] = k.type
50
57
  node_sv["name"] = k.name
51
58
  node_sv["href"] = k.href
52
59
 
53
- node_lp = create_child("LocalityParams")
60
+ node_lp = create_child("LocalityParams",
61
+ namespace.prefix,
62
+ namespace.href)
63
+
54
64
  node_sv.after(node_lp)
55
65
 
56
- node_re = add_child("ResourceEntity", nil, nil, node_lp)
66
+ node_re = add_child("ResourceEntity",
67
+ namespace.prefix,
68
+ namespace.href,
69
+ node_lp)
70
+
57
71
  node_re["type"] = v.type
58
72
  node_re["name"] = v.name
59
73
  node_re["href"] = v.href
@@ -26,13 +26,10 @@ module VCloudSdk
26
26
  def add_source_item(entity_to_add_href)
27
27
  return unless entity_to_add_href
28
28
 
29
- prefix = namespace.prefix
30
- prefix += ':' if prefix
31
-
32
- node_sourced_item = create_child("#{prefix}SourcedItem")
29
+ node_sourced_item = create_child("SourcedItem", namespace.prefix, namespace.href)
33
30
  node_sourced_item["sourceDelete"] = "true"
34
31
 
35
- node_source = add_child("#{prefix}Source", nil, nil, node_sourced_item)
32
+ node_source = add_child("Source", namespace.prefix, namespace.href, node_sourced_item)
36
33
  node_source["href"] = entity_to_add_href
37
34
 
38
35
  get_nodes("AllEULAsAccepted").first.node.before(node_sourced_item)
@@ -28,7 +28,8 @@ module VCloudSdk
28
28
  end
29
29
 
30
30
  def highest_instance_id
31
- hardware.map{|h| h.instance_id}.max
31
+ ids = hardware.map{|h| h.get_rasd_content(RASD_TYPES[:INSTANCE_ID])}.compact
32
+ ids.map {|id| id.to_i}.max
32
33
  end
33
34
 
34
35
  def nics
@@ -116,10 +116,15 @@ module VCloudSdk
116
116
  section.add_item(new_disk)
117
117
  # The order matters!
118
118
  new_disk.add_rasd(RASD_TYPES[:HOST_RESOURCE])
119
- new_disk.add_rasd(RASD_TYPES[:INSTANCE_ID])
119
+
120
+ instance_id_type = RASD_TYPES[:INSTANCE_ID]
121
+ new_disk.add_rasd(instance_id_type)
122
+ new_disk.set_rasd(instance_id_type, section.highest_instance_id + 1)
123
+
120
124
  rt = RASD_TYPES[:RESOURCE_TYPE]
121
125
  new_disk.add_rasd(rt)
122
126
  new_disk.set_rasd(rt, HARDWARE_TYPE[:HARD_DISK])
127
+
123
128
  host_resource = new_disk.get_rasd(RASD_TYPES[:HOST_RESOURCE])
124
129
  host_resource[new_disk.create_qualified_name(
125
130
  "capacity", VCLOUD_NAMESPACE)] = size_mb.to_s
metadata CHANGED
@@ -1,68 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_vcloud_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
5
- prerelease:
4
+ version: 0.5.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - VMware
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-05 00:00:00.000000000 Z
11
+ date: 2014-02-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bosh_common
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
- version: 1.5.0.pre3
19
+ version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: 1.5.0.pre3
26
+ version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bosh_cpi
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
- version: 1.5.0.pre3
33
+ version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
- version: 1.5.0.pre3
40
+ version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: yajl-ruby
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: 0.8.2
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: 0.8.2
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: builder
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: httpclient
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - '='
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - '='
92
81
  - !ruby/object:Gem::Version
@@ -94,7 +83,6 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rest-client
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
87
  - - ~>
100
88
  - !ruby/object:Gem::Version
@@ -102,7 +90,6 @@ dependencies:
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
94
  - - ~>
108
95
  - !ruby/object:Gem::Version
@@ -110,7 +97,6 @@ dependencies:
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: nokogiri
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - ~>
116
102
  - !ruby/object:Gem::Version
@@ -118,19 +104,19 @@ dependencies:
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - ~>
124
109
  - !ruby/object:Gem::Version
125
110
  version: 1.5.6
126
- description: ! 'BOSH vCloud CPI
127
-
128
- 6c277e'
129
- email: vchs-cf@rbcon.com
111
+ description: |-
112
+ BOSH vCloud CPI
113
+ 5ea4fb
114
+ email: support@cloudfoundry.com
130
115
  executables: []
131
116
  extensions: []
132
117
  extra_rdoc_files: []
133
118
  files:
119
+ - README.md
134
120
  - lib/cloud/vcloud.rb
135
121
  - lib/cloud/vcloud/cache.rb
136
122
  - lib/cloud/vcloud/cloud.rb
@@ -396,30 +382,29 @@ files:
396
382
  - lib/cloud/vcloud/xml/xml_templates/VmPendingQuestion.xml
397
383
  - lib/cloud/vcloud/xml/xml_templates/VmQuestionAnswer.xml
398
384
  - lib/cloud/vcloud/xml/xml_templates/generate_dictionary.rb
399
- - README.md
400
- homepage: https://github.com/vchs/bosh_vcloud_cpi
385
+ homepage: https://github.com/cloudfoundry/bosh
401
386
  licenses:
402
387
  - Apache 2.0
388
+ metadata: {}
403
389
  post_install_message:
404
390
  rdoc_options: []
405
391
  require_paths:
406
392
  - lib
407
393
  required_ruby_version: !ruby/object:Gem::Requirement
408
- none: false
409
394
  requirements:
410
- - - ! '>='
395
+ - - '>='
411
396
  - !ruby/object:Gem::Version
412
397
  version: 1.9.3
413
398
  required_rubygems_version: !ruby/object:Gem::Requirement
414
- none: false
415
399
  requirements:
416
- - - ! '>='
400
+ - - '>='
417
401
  - !ruby/object:Gem::Version
418
402
  version: '0'
419
403
  requirements: []
420
404
  rubyforge_project:
421
- rubygems_version: 1.8.24
405
+ rubygems_version: 2.2.0
422
406
  signing_key:
423
- specification_version: 3
407
+ specification_version: 4
424
408
  summary: BOSH vCloud CPI
425
409
  test_files: []
410
+ has_rdoc: