bosh_vcloud_cpi 0.7.3 → 0.7.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c5d94e5c6e04f3c4c4278102318721310992985
4
- data.tar.gz: 87e9ec2ac54d8ed07b5c19d2f6b1fda889158fa9
3
+ metadata.gz: 631972cbe9ebb1d34753f50afa184b2e0f99f5b7
4
+ data.tar.gz: 4afd0a8fe7f88e48ece8ed491873e89a0c804528
5
5
  SHA512:
6
- metadata.gz: 0248558f421c4433ce1bf5cf5d93ffb03f4fa81736d3bb0669de0dc11b76445dced85cbc51d5a932ae9f24f7f7e58e7c6b69a41190d90857fd54f58ecef864f7
7
- data.tar.gz: a9df0812cc617f95f9fae56c1c3cb9a62b4bb42b87980334d3ad8ccc8b459d383f39862f403f48a07f034f1a7a8d96548aa65b482e3d96be55e30a986deddd04
6
+ metadata.gz: dba493026be365861d5871760c420234e48658b6deec07bb787c50a10fd1fe4333fb38542df6363641f4b345aa804210fb4c7c43e335464570e5a0c1ee48e5a2
7
+ data.tar.gz: 33bab3c5429fdf91eed0caa1a10f2d28e9734500df1d4f0db8908a53786180d60c475defb1ea16df3433fdee2a3e2a4cac53c7c282a1bca8cf0dbc3f8ccb9c06
@@ -31,6 +31,7 @@ module VCloudCloud
31
31
  s.next Steps::StemcellInfo, image
32
32
  s.next Steps::CreateTemplate, "sc-#{unique_name}"
33
33
  s.next Steps::UploadTemplateFiles
34
+ s.next Steps::AddCatalog, @client.catalog_name(:vapp)
34
35
  s.next Steps::AddCatalogItem, :vapp, s.state[:vapp_template]
35
36
  end)[:catalog_item].urn
36
37
  end
@@ -77,6 +77,7 @@ require_relative 'steps/stemcell_info'
77
77
  require_relative 'steps/create_template'
78
78
  require_relative 'steps/create_media'
79
79
  require_relative 'steps/upload_template_files'
80
+ require_relative 'steps/add_catalog'
80
81
  require_relative 'steps/add_catalog_item'
81
82
  require_relative 'steps/instantiate'
82
83
  require_relative 'steps/recompose'
@@ -0,0 +1,35 @@
1
+ module VCloudCloud
2
+ module Steps
3
+ class AddCatalog < Step
4
+ def perform(name, &block)
5
+ catalog = VCloudSdk::Xml::WrapperFactory.create_instance 'AdminCatalog'
6
+ catalog.name = name
7
+ link = client.org.add_catalog_link
8
+ begin
9
+ result = client.invoke :post,
10
+ link,
11
+ :payload => catalog,
12
+ :headers => { :content_type => link.type }
13
+ state[:catalog] = client.wait_entity result
14
+ client.flush_cache
15
+ rescue RestClient::BadRequest
16
+ # check if catalog already exists; if so, this is not an error
17
+ client.flush_cache
18
+ catalog = client.org.catalog_link(name)
19
+ if catalog
20
+ return catalog
21
+ end
22
+ raise
23
+ end
24
+ end
25
+
26
+ def rollback
27
+ catalog = state[:catalog]
28
+ return unless catalog
29
+
30
+ client.invoke :delete, catalog
31
+ state.delete :catalog
32
+ end
33
+ end
34
+ end
35
+ end
@@ -61,9 +61,13 @@ module VCloudCloud
61
61
  end
62
62
  end
63
63
 
64
- # catalog should be either :vapp or :media
64
+ # catalog_type should be either :vapp or :media
65
+ def catalog_name(catalog_type)
66
+ @entities["#{catalog_type.to_s}_catalog"]
67
+ end
68
+
65
69
  def catalog(catalog_type)
66
- catalog_link = org.catalog_link @entities["#{catalog_type.to_s}_catalog"]
70
+ catalog_link = org.catalog_link catalog_name(catalog_type)
67
71
  raise ObjectNotFoundError, "Invalid catalog type: #{catalog_type}" unless catalog_link
68
72
  resolve_link catalog_link
69
73
  end
@@ -96,6 +96,10 @@ module VCloudSdk
96
96
  @root["name"]
97
97
  end
98
98
 
99
+ def name=(name)
100
+ @root["name"] = name
101
+ end
102
+
99
103
  def urn
100
104
  @root["id"]
101
105
  end
@@ -14,7 +14,19 @@ module VCloudSdk
14
14
  get_nodes("CatalogItem")
15
15
  end
16
16
  end
17
- end
18
17
 
18
+ def running_tasks
19
+ tasks.find_all {|t| RUNNING.include?(t.status)}
20
+ end
21
+
22
+ def tasks
23
+ get_nodes("Task")
24
+ end
25
+
26
+ private
27
+
28
+ RUNNING = [TASK_STATUS[:RUNNING], TASK_STATUS[:QUEUED],
29
+ TASK_STATUS[:PRE_RUNNING]]
30
+ end
19
31
  end
20
32
  end
@@ -16,6 +16,17 @@ module VCloudSdk
16
16
  "name" => name},
17
17
  true).first
18
18
  end
19
+
20
+ def add_catalog_link
21
+ link = get_nodes("Link",
22
+ {"rel" => "add",
23
+ "type" => ADMIN_MEDIA_TYPE[:ADMIN_CATALOG]},
24
+ true).first
25
+ if !link
26
+ raise "Couldn't find add catalog link in #{@root}"
27
+ end
28
+ return link
29
+ end
19
30
  end
20
31
  end
21
32
  end
@@ -1 +1,6 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns7:AdminCatalog xmlns="http://www.vmware.com/vcloud/extension/v1" xmlns:ns2="http://www.vmware.com/vcloud/v1" xmlns:ns3="http://schemas.dmtf.org/ovf/envelope/1" xmlns:ns4="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:ns5="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:ns6="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ns7="http://www.vmware.com/vcloud/v1.5" xmlns:ns8="http://schemas.dmtf.org/ovf/environment/1" xmlns:ns9="http://www.vmware.com/vcloud/extension/v1.5" xmlns:ns10="http://www.vmware.com/vcloud/versions" name="" id="" type="" href=""><ns7:Description></ns7:Description><ns7:Tasks/><ns7:Owner/><ns7:CatalogItems/><ns7:IsPublished>false</ns7:IsPublished></ns7:AdminCatalog>
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <AdminCatalog
3
+ xmlns="http://www.vmware.com/vcloud/v1.5"
4
+ name="">
5
+ <Description></Description>
6
+ </AdminCatalog>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_vcloud_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bosh_common
@@ -124,7 +124,7 @@ dependencies:
124
124
  version: '0'
125
125
  description: |-
126
126
  BOSH vCloud CPI
127
- 7d1662
127
+ 697696
128
128
  email: support@cloudfoundry.com
129
129
  executables: []
130
130
  extensions: []
@@ -137,6 +137,7 @@ files:
137
137
  - lib/cloud/vcloud/errors.rb
138
138
  - lib/cloud/vcloud/file_uploader.rb
139
139
  - lib/cloud/vcloud/steps.rb
140
+ - lib/cloud/vcloud/steps/add_catalog.rb
140
141
  - lib/cloud/vcloud/steps/add_catalog_item.rb
141
142
  - lib/cloud/vcloud/steps/add_networks.rb
142
143
  - lib/cloud/vcloud/steps/attach_detach_disk.rb
@@ -416,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
416
417
  version: '0'
417
418
  requirements: []
418
419
  rubyforge_project:
419
- rubygems_version: 2.2.2
420
+ rubygems_version: 2.4.3
420
421
  signing_key:
421
422
  specification_version: 4
422
423
  summary: BOSH vCloud CPI