bosh_vcloud_cpi 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloud/vcloud/cloud.rb +1 -0
- data/lib/cloud/vcloud/steps.rb +1 -0
- data/lib/cloud/vcloud/steps/add_catalog.rb +35 -0
- data/lib/cloud/vcloud/vcd_client.rb +6 -2
- data/lib/cloud/vcloud/xml/wrapper.rb +4 -0
- data/lib/cloud/vcloud/xml/wrapper_classes/admin_catalog.rb +13 -1
- data/lib/cloud/vcloud/xml/wrapper_classes/org.rb +11 -0
- data/lib/cloud/vcloud/xml/xml_templates/AdminCatalog.xml +6 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 631972cbe9ebb1d34753f50afa184b2e0f99f5b7
|
4
|
+
data.tar.gz: 4afd0a8fe7f88e48ece8ed491873e89a0c804528
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dba493026be365861d5871760c420234e48658b6deec07bb787c50a10fd1fe4333fb38542df6363641f4b345aa804210fb4c7c43e335464570e5a0c1ee48e5a2
|
7
|
+
data.tar.gz: 33bab3c5429fdf91eed0caa1a10f2d28e9734500df1d4f0db8908a53786180d60c475defb1ea16df3433fdee2a3e2a4cac53c7c282a1bca8cf0dbc3f8ccb9c06
|
data/lib/cloud/vcloud/cloud.rb
CHANGED
@@ -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
|
data/lib/cloud/vcloud/steps.rb
CHANGED
@@ -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
|
-
#
|
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
|
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
|
@@ -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"
|
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.
|
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-
|
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
|
-
|
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.
|
420
|
+
rubygems_version: 2.4.3
|
420
421
|
signing_key:
|
421
422
|
specification_version: 4
|
422
423
|
summary: BOSH vCloud CPI
|