bosh-cloudfoundry 0.7.0.alpha.3 → 0.7.0.alpha.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.
- data/ChangeLog.md +1 -0
- data/bosh-cloudfoundry.gemspec +2 -1
- data/lib/bosh/cli/commands/cf.rb +35 -130
- data/lib/bosh/cloudfoundry.rb +5 -2
- data/lib/bosh/cloudfoundry/deployment_attributes.rb +35 -30
- data/lib/bosh/cloudfoundry/deployment_file.rb +192 -0
- data/lib/bosh/cloudfoundry/release_version.rb +67 -0
- data/lib/bosh/cloudfoundry/release_version_cpi.rb +55 -0
- data/lib/bosh/cloudfoundry/release_version_cpi_size.rb +49 -0
- data/spec/assets/v132/aws/large.yml +393 -0
- data/spec/assets/v132/aws/medium.yml +350 -0
- data/spec/deployment_file_spec.rb +92 -0
- data/spec/plugin_spec.rb +32 -47
- data/spec/release_version_cpi_size_spec.rb +13 -0
- data/spec/release_version_cpi_spec.rb +17 -0
- data/spec/release_version_spec.rb +38 -0
- data/spec/spec_helper.rb +2 -0
- data/templates/v132/aws/large/deployment_file.yml.erb +431 -0
- data/templates/v132/aws/{dev → large}/spec +0 -0
- data/templates/v132/{openstack/dev → aws/medium}/deployment_file.yml.erb +35 -23
- data/templates/v132/{openstack/dev → aws/medium}/spec +0 -0
- data/templates/v132/aws/small/README.md +5 -0
- data/templates/v132/aws/spec +6 -0
- data/templates/v132/openstack/large/deployment_file.yml.erb +431 -0
- data/templates/v132/openstack/large/spec +6 -0
- data/templates/v132/{aws/dev → openstack/medium}/deployment_file.yml.erb +35 -23
- data/templates/v132/openstack/medium/spec +6 -0
- data/templates/v132/openstack/spec +6 -0
- metadata +46 -10
- data/lib/bosh/cloudfoundry/release_versioned_template.rb +0 -48
- data/spec/release_versioned_template_spec.rb +0 -12
@@ -0,0 +1,350 @@
|
|
1
|
+
---
|
2
|
+
name: demo
|
3
|
+
director_uuid: UUID
|
4
|
+
|
5
|
+
releases:
|
6
|
+
- name: cf-release
|
7
|
+
version: 132
|
8
|
+
|
9
|
+
networks:
|
10
|
+
- name: floating
|
11
|
+
type: vip
|
12
|
+
cloud_properties: {}
|
13
|
+
- name: default
|
14
|
+
type: dynamic
|
15
|
+
cloud_properties:
|
16
|
+
security_groups:
|
17
|
+
- default
|
18
|
+
|
19
|
+
update:
|
20
|
+
canaries: 1
|
21
|
+
canary_watch_time: 30000-600000
|
22
|
+
update_watch_time: 30000-600000
|
23
|
+
max_in_flight: 4
|
24
|
+
max_errors: 1
|
25
|
+
|
26
|
+
compilation:
|
27
|
+
workers: 6
|
28
|
+
network: default
|
29
|
+
reuse_compilation_vms: true
|
30
|
+
cloud_properties:
|
31
|
+
instance_type: m1.medium
|
32
|
+
|
33
|
+
resource_pools:
|
34
|
+
- name: small
|
35
|
+
network: default
|
36
|
+
size: 2
|
37
|
+
stemcell:
|
38
|
+
name: bosh-stemcell
|
39
|
+
version: latest
|
40
|
+
cloud_properties:
|
41
|
+
instance_type: m1.small
|
42
|
+
|
43
|
+
- name: medium
|
44
|
+
network: default
|
45
|
+
size: 2
|
46
|
+
stemcell:
|
47
|
+
name: bosh-stemcell
|
48
|
+
version: latest
|
49
|
+
cloud_properties:
|
50
|
+
instance_type: m1.medium
|
51
|
+
|
52
|
+
jobs:
|
53
|
+
- name: core
|
54
|
+
release: cf-release
|
55
|
+
template:
|
56
|
+
- syslog_aggregator
|
57
|
+
- nats
|
58
|
+
- postgres
|
59
|
+
- health_manager_next
|
60
|
+
- collector
|
61
|
+
- debian_nfs_server
|
62
|
+
- login
|
63
|
+
instances: 1
|
64
|
+
resource_pool: medium
|
65
|
+
persistent_disk: 4096
|
66
|
+
networks:
|
67
|
+
- name: default
|
68
|
+
default:
|
69
|
+
- dns
|
70
|
+
- gateway
|
71
|
+
properties:
|
72
|
+
db: databases
|
73
|
+
|
74
|
+
# need a separate job for uaa due to https://github.com/cloudfoundry/cf-release/issues/104
|
75
|
+
- name: uaa
|
76
|
+
release: cf-release
|
77
|
+
template:
|
78
|
+
- uaa
|
79
|
+
instances: 1
|
80
|
+
resource_pool: small
|
81
|
+
networks:
|
82
|
+
- name: default
|
83
|
+
default: [dns, gateway]
|
84
|
+
|
85
|
+
- name: api
|
86
|
+
release: cf-release
|
87
|
+
template:
|
88
|
+
- cloud_controller_ng
|
89
|
+
- gorouter
|
90
|
+
instances: 1
|
91
|
+
resource_pool: medium
|
92
|
+
networks:
|
93
|
+
- name: default
|
94
|
+
default:
|
95
|
+
- dns
|
96
|
+
- gateway
|
97
|
+
- name: floating
|
98
|
+
static_ips:
|
99
|
+
- 1.2.3.4
|
100
|
+
properties:
|
101
|
+
db: databases
|
102
|
+
|
103
|
+
- name: dea
|
104
|
+
release: cf-release
|
105
|
+
template:
|
106
|
+
- dea_next
|
107
|
+
instances: 1
|
108
|
+
resource_pool: small
|
109
|
+
networks:
|
110
|
+
- name: default
|
111
|
+
default: [dns, gateway]
|
112
|
+
|
113
|
+
properties:
|
114
|
+
cf:
|
115
|
+
name: demo
|
116
|
+
dns: mycloud.com
|
117
|
+
ip_addresses: ["1.2.3.4"]
|
118
|
+
deployment_size: medium
|
119
|
+
security_group: default
|
120
|
+
persistent_disk: 4096
|
121
|
+
common_password: qwertyasdfgh
|
122
|
+
|
123
|
+
domain: mycloud.com
|
124
|
+
system_domain: mycloud.com.com
|
125
|
+
system_domain_organization: system_domain
|
126
|
+
app_domains:
|
127
|
+
- mycloud.com
|
128
|
+
|
129
|
+
networks:
|
130
|
+
apps: default
|
131
|
+
management: default
|
132
|
+
|
133
|
+
nats:
|
134
|
+
address: 0.core.default.demo.microbosh
|
135
|
+
port: 4222
|
136
|
+
user: nats
|
137
|
+
password: qwertyasdfgh
|
138
|
+
authorization_timeout: 5
|
139
|
+
|
140
|
+
router:
|
141
|
+
port: 8081
|
142
|
+
status:
|
143
|
+
port: 8080
|
144
|
+
user: gorouter
|
145
|
+
password: qwertyasdfgh
|
146
|
+
|
147
|
+
dea: &dea
|
148
|
+
max_memory: 4096
|
149
|
+
memory_mb: 4084
|
150
|
+
memory_overcommit_factor: 4
|
151
|
+
disk_mb: 4096
|
152
|
+
disk_overcommit_factor: 4
|
153
|
+
|
154
|
+
dea_next: *dea
|
155
|
+
|
156
|
+
service_lifecycle:
|
157
|
+
serialization_data_server:
|
158
|
+
- 0.core.default.demo.microbosh
|
159
|
+
|
160
|
+
syslog_aggregator:
|
161
|
+
address: 0.core.default.demo.microbosh
|
162
|
+
port: 54321
|
163
|
+
|
164
|
+
serialization_data_server:
|
165
|
+
port: 8080
|
166
|
+
logging_level: debug
|
167
|
+
upload_token: qwertyasdfgh
|
168
|
+
upload_timeout: 10
|
169
|
+
|
170
|
+
collector:
|
171
|
+
deployment_name: cf
|
172
|
+
use_tsdb: false
|
173
|
+
use_aws_cloudwatch: false
|
174
|
+
use_datadog: false
|
175
|
+
|
176
|
+
nfs_server:
|
177
|
+
address: 0.core.default.demo.microbosh
|
178
|
+
#network: "*.demo.microbosh"
|
179
|
+
#idmapd_domain: mycloud.com
|
180
|
+
|
181
|
+
debian_nfs_server:
|
182
|
+
no_root_squash: true
|
183
|
+
|
184
|
+
databases: &databases
|
185
|
+
db_scheme: postgres
|
186
|
+
address: 0.core.default.demo.microbosh
|
187
|
+
port: 5524
|
188
|
+
roles:
|
189
|
+
- tag: admin
|
190
|
+
name: ccadmin
|
191
|
+
password: qwertyasdfgh
|
192
|
+
- tag: admin
|
193
|
+
name: uaaadmin
|
194
|
+
password: qwertyasdfgh
|
195
|
+
databases:
|
196
|
+
- tag: cc
|
197
|
+
name: ccdb
|
198
|
+
citext: true
|
199
|
+
- tag: uaa
|
200
|
+
name: uaadb
|
201
|
+
citext: true
|
202
|
+
|
203
|
+
ccdb: &ccdb
|
204
|
+
db_scheme: postgres
|
205
|
+
address: 0.core.default.demo.microbosh
|
206
|
+
port: 5524
|
207
|
+
roles:
|
208
|
+
- tag: admin
|
209
|
+
name: ccadmin
|
210
|
+
password: qwertyasdfgh
|
211
|
+
databases:
|
212
|
+
- tag: cc
|
213
|
+
name: ccdb
|
214
|
+
citext: true
|
215
|
+
|
216
|
+
ccdb_ng: *ccdb
|
217
|
+
|
218
|
+
uaadb:
|
219
|
+
db_scheme: postgresql
|
220
|
+
address: 0.core.default.demo.microbosh
|
221
|
+
port: 5524
|
222
|
+
roles:
|
223
|
+
- tag: admin
|
224
|
+
name: uaaadmin
|
225
|
+
password: qwertyasdfgh
|
226
|
+
databases:
|
227
|
+
- tag: uaa
|
228
|
+
name: uaadb
|
229
|
+
citext: true
|
230
|
+
|
231
|
+
cc_api_version: v2
|
232
|
+
|
233
|
+
cc: &cc
|
234
|
+
logging_level: debug
|
235
|
+
external_host: ccng
|
236
|
+
srv_api_uri: http://api.mycloud.com
|
237
|
+
cc_partition: default
|
238
|
+
db_encryption_key: "b963127302433579"
|
239
|
+
bootstrap_admin_email: admin@mycloud.com
|
240
|
+
bulk_api_password: qwertyasdfgh
|
241
|
+
uaa_resource_id: cloud_controller
|
242
|
+
staging_upload_user: uploaduser
|
243
|
+
staging_upload_password: qwertyasdfgh
|
244
|
+
resource_pool:
|
245
|
+
resource_directory_key: cc-resources
|
246
|
+
# Local provider when using NFS
|
247
|
+
fog_connection:
|
248
|
+
provider: Local
|
249
|
+
local_root: /var/vcap/shared
|
250
|
+
packages:
|
251
|
+
app_package_directory_key: cc-packages
|
252
|
+
droplets:
|
253
|
+
droplet_directory_key: cc-droplets
|
254
|
+
|
255
|
+
ccng: *cc
|
256
|
+
|
257
|
+
login:
|
258
|
+
protocol: http
|
259
|
+
links:
|
260
|
+
home: http://console.mycloud.com
|
261
|
+
passwd: http://console.mycloud.com/password_resets/new
|
262
|
+
signup: http://console.mycloud.com/register
|
263
|
+
|
264
|
+
uaa:
|
265
|
+
url: http://uaa.mycloud.com
|
266
|
+
spring_profiles: postgresql
|
267
|
+
no_ssl: true
|
268
|
+
catalina_opts: -Xmx768m -XX:MaxPermSize=256m
|
269
|
+
resource_id: account_manager
|
270
|
+
jwt:
|
271
|
+
signing_key: |
|
272
|
+
-----BEGIN RSA PRIVATE KEY-----
|
273
|
+
MIICXAIBAAKBgQDHFr+KICms+tuT1OXJwhCUmR2dKVy7psa8xzElSyzqx7oJyfJ1
|
274
|
+
JZyOzToj9T5SfTIq396agbHJWVfYphNahvZ/7uMXqHxf+ZH9BL1gk9Y6kCnbM5R6
|
275
|
+
0gfwjyW1/dQPjOzn9N394zd2FJoFHwdq9Qs0wBugspULZVNRxq7veq/fzwIDAQAB
|
276
|
+
AoGBAJ8dRTQFhIllbHx4GLbpTQsWXJ6w4hZvskJKCLM/o8R4n+0W45pQ1xEiYKdA
|
277
|
+
Z/DRcnjltylRImBD8XuLL8iYOQSZXNMb1h3g5/UGbUXLmCgQLOUUlnYt34QOQm+0
|
278
|
+
KvUqfMSFBbKMsYBAoQmNdTHBaz3dZa8ON9hh/f5TT8u0OWNRAkEA5opzsIXv+52J
|
279
|
+
duc1VGyX3SwlxiE2dStW8wZqGiuLH142n6MKnkLU4ctNLiclw6BZePXFZYIK+AkE
|
280
|
+
xQ+k16je5QJBAN0TIKMPWIbbHVr5rkdUqOyezlFFWYOwnMmw/BKa1d3zp54VP/P8
|
281
|
+
+5aQ2d4sMoKEOfdWH7UqMe3FszfYFvSu5KMCQFMYeFaaEEP7Jn8rGzfQ5HQd44ek
|
282
|
+
lQJqmq6CE2BXbY/i34FuvPcKU70HEEygY6Y9d8J3o6zQ0K9SYNu+pcXt4lkCQA3h
|
283
|
+
jJQQe5uEGJTExqed7jllQ0khFJzLMx0K6tj0NeeIzAaGCQz13oo2sCdeGRHO4aDh
|
284
|
+
HH6Qlq/6UOV5wP8+GAcCQFgRCcB+hrje8hfEEefHcFpyKH+5g1Eu1k0mLrxK2zd+
|
285
|
+
4SlotYRHgPCEubokb2S1zfZDWIXW3HmggnGgM949TlY=
|
286
|
+
-----END RSA PRIVATE KEY-----
|
287
|
+
verification_key: |
|
288
|
+
-----BEGIN PUBLIC KEY-----
|
289
|
+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDHFr+KICms+tuT1OXJwhCUmR2d
|
290
|
+
KVy7psa8xzElSyzqx7oJyfJ1JZyOzToj9T5SfTIq396agbHJWVfYphNahvZ/7uMX
|
291
|
+
qHxf+ZH9BL1gk9Y6kCnbM5R60gfwjyW1/dQPjOzn9N394zd2FJoFHwdq9Qs0wBug
|
292
|
+
spULZVNRxq7veq/fzwIDAQAB
|
293
|
+
-----END PUBLIC KEY-----
|
294
|
+
cc:
|
295
|
+
client_secret: qwertyasdfgh
|
296
|
+
admin:
|
297
|
+
client_secret: qwertyasdfgh
|
298
|
+
batch:
|
299
|
+
username: batchuser
|
300
|
+
password: qwertyasdfgh
|
301
|
+
client:
|
302
|
+
autoapprove:
|
303
|
+
- cf
|
304
|
+
- my
|
305
|
+
- micro
|
306
|
+
- support-signon
|
307
|
+
- login
|
308
|
+
clients:
|
309
|
+
login:
|
310
|
+
override: true
|
311
|
+
scope: openid
|
312
|
+
authorities: oauth.login
|
313
|
+
secret: qwertyasdfgh
|
314
|
+
authorized-grant-types: authorization_code,client_credentials,refresh_token
|
315
|
+
redirect-uri: http://login.mycloud.com
|
316
|
+
support-services:
|
317
|
+
scope: scim.write,scim.read,openid,cloud_controller.read,cloud_controller.write
|
318
|
+
secret: qwertyasdfgh
|
319
|
+
authorized-grant-types: authorization_code,client_credentials
|
320
|
+
redirect-uri: http://support-signon.mycloud.com
|
321
|
+
authorities: portal.users.read
|
322
|
+
access-token-validity: 1209600
|
323
|
+
refresh-token-validity: 1209600
|
324
|
+
oauth2service:
|
325
|
+
secret: qwertyasdfgh
|
326
|
+
scope: openid,cloud_controller.read,cloud_controller.write
|
327
|
+
authorities: uaa.resource,oauth.service,clients.read,clients.write,clients.secret
|
328
|
+
authorized-grant-types: client_credentials,implicit
|
329
|
+
redirect-uri: http://rewritten-later.cloudfoundry.com/whatever
|
330
|
+
override: true
|
331
|
+
autoapprove: true
|
332
|
+
cf:
|
333
|
+
override: true
|
334
|
+
authorized-grant-types: password,implicit,refresh_token
|
335
|
+
authorities: uaa.none
|
336
|
+
scope: cloud_controller.read,cloud_controller.write,openid,password.write,cloud_controller.admin,scim.read,scim.write
|
337
|
+
access-token-validity: 7200
|
338
|
+
refresh-token-validity: 1209600
|
339
|
+
servicesmgmt:
|
340
|
+
override: true
|
341
|
+
secret: qwertyasdfgh
|
342
|
+
scope: openid,cloud_controller.read,cloud_controller.write
|
343
|
+
authorities: uaa.resource,oauth.service,clients.read,clients.write,clients.secret
|
344
|
+
authorized-grant-types: authorization_code,client_credentials,password,implicit
|
345
|
+
redirect-uri: http://servicesmgmt.mycloud.com/auth/cloudfoundry/callback
|
346
|
+
autoapprove: true
|
347
|
+
scim:
|
348
|
+
users:
|
349
|
+
- admin|qwertyasdfgh|scim.write,scim.read,openid,cloud_controller.admin
|
350
|
+
- services|qwertyasdfgh|scim.write,scim.read,openid,cloud_controller.admin
|
@@ -0,0 +1,92 @@
|
|
1
|
+
describe Bosh::Cloudfoundry::DeploymentFile do
|
2
|
+
|
3
|
+
def initial_deployment_file(properties = {})
|
4
|
+
FileUtils.mkdir_p(home_file("deployments/cf"))
|
5
|
+
file = home_file("deployments/cf/demo.yml")
|
6
|
+
File.open(file, "w") do |f|
|
7
|
+
f << {
|
8
|
+
"name" => "demo",
|
9
|
+
"releases" => [
|
10
|
+
{"name" => "cf-release", "version" => 132}
|
11
|
+
],
|
12
|
+
"properties" => {
|
13
|
+
"cf" => properties.merge({
|
14
|
+
"dns" => "mycloud.com",
|
15
|
+
"ip_addresses" => ['1.2.3.4'],
|
16
|
+
"deployment_size" => "medium",
|
17
|
+
"security_group" => "cf",
|
18
|
+
"persistent_disk" => 4096,
|
19
|
+
"common_passwords" => "qwerty"
|
20
|
+
})
|
21
|
+
}
|
22
|
+
}.to_yaml
|
23
|
+
end
|
24
|
+
file
|
25
|
+
end
|
26
|
+
|
27
|
+
it "can reconstruct DeploymentFile from even minimal deployment file" do
|
28
|
+
file = initial_deployment_file
|
29
|
+
deployment_file = Bosh::Cloudfoundry::DeploymentFile.reconstruct_from_deployment_file(
|
30
|
+
file, mock("director"), {"cpi" => "openstack"})
|
31
|
+
|
32
|
+
# simple tests to check the values all went into the right places
|
33
|
+
deployment_file.deployment_size.should == "medium"
|
34
|
+
deployment_file.deployment_attributes.dns.should == "mycloud.com"
|
35
|
+
deployment_file.bosh_cpi.should == "openstack"
|
36
|
+
deployment_file.release_version_number.should == 132
|
37
|
+
end
|
38
|
+
|
39
|
+
context "generates deployment (aws)" do
|
40
|
+
let(:bosh_cpi) { "aws" }
|
41
|
+
let(:bosh_status) { {"cpi" => bosh_cpi, "uuid" => "UUID"} }
|
42
|
+
let(:release_version_cpi) { Bosh::Cloudfoundry::ReleaseVersionCpi.latest_for_cpi(bosh_cpi) }
|
43
|
+
let(:release_version_cpi_medium) { Bosh::Cloudfoundry::ReleaseVersionCpiSize.new(release_version_cpi, "medium") }
|
44
|
+
let(:deployment_attributes) do
|
45
|
+
Bosh::Cloudfoundry::DeploymentAttributes.new(mock("director"), bosh_status, release_version_cpi_medium, {
|
46
|
+
name: "demo",
|
47
|
+
dns: "mycloud.com",
|
48
|
+
ip_addresses: ['1.2.3.4']
|
49
|
+
})
|
50
|
+
end
|
51
|
+
|
52
|
+
subject { Bosh::Cloudfoundry::DeploymentFile.new(release_version_cpi_medium, deployment_attributes, bosh_status) }
|
53
|
+
|
54
|
+
before do
|
55
|
+
subject.biff.stub(:deployment).and_return(home_file("deployments/cf/demo.yml"))
|
56
|
+
deployment_cmd = mock("deployment_cmd")
|
57
|
+
deployment_cmd.stub(:set_current).with(home_file("deployments/cf/demo.yml"))
|
58
|
+
deployment_cmd.stub(:perform)
|
59
|
+
subject.stub(:deployment_cmd).and_return(deployment_cmd)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "medium size" do
|
63
|
+
in_home_dir do
|
64
|
+
file = home_file("deployments/cf/demo.yml")
|
65
|
+
subject.prepare_environment
|
66
|
+
subject.create_deployment_file
|
67
|
+
subject.deploy(non_interactive: true)
|
68
|
+
manifest = YAML.load_file(file)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
#
|
72
|
+
# it "generates a large deployment" do
|
73
|
+
# in_home_dir do
|
74
|
+
# command.add_option(:deployment_size, "large")
|
75
|
+
#
|
76
|
+
# command.create_cf
|
77
|
+
# files_match(spec_asset("v132/aws/large.yml"), command.deployment_file)
|
78
|
+
#
|
79
|
+
# manifest = YAML.load_file(command.deployment_file)
|
80
|
+
# Bosh::Cli::DeploymentManifest.new(manifest).normalize
|
81
|
+
# end
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# it "specifies core size" do
|
85
|
+
# in_home_dir do
|
86
|
+
# command.add_option(:size, "xlarge")
|
87
|
+
# command.create_cf
|
88
|
+
# end
|
89
|
+
# end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
data/spec/plugin_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "bosh/cli/commands/cf"
|
2
|
+
require "fakeweb"
|
2
3
|
|
3
4
|
describe Bosh::Cli::Command::CloudFoundry do
|
4
5
|
include FileUtils
|
@@ -11,6 +12,7 @@ describe Bosh::Cli::Command::CloudFoundry do
|
|
11
12
|
end
|
12
13
|
|
13
14
|
before { setup_home_dir }
|
15
|
+
before { FakeWeb.allow_net_connect = false }
|
14
16
|
|
15
17
|
it "shows help" do
|
16
18
|
subject.cf_help
|
@@ -53,12 +55,13 @@ describe Bosh::Cli::Command::CloudFoundry do
|
|
53
55
|
end
|
54
56
|
|
55
57
|
context "with requirements" do
|
56
|
-
|
58
|
+
it "creates cf deployment" do
|
57
59
|
command.add_option(:config, home_file(".bosh_config"))
|
58
60
|
command.add_option(:non_interactive, true)
|
59
61
|
command.add_option(:name, "demo")
|
60
62
|
command.add_option(:ip, ["1.2.3.4"])
|
61
63
|
command.add_option(:dns, "mycloud.com")
|
64
|
+
command.add_option(:common_password, "qwertyasdfgh")
|
62
65
|
|
63
66
|
command.should_receive(:auth_required)
|
64
67
|
|
@@ -67,60 +70,42 @@ describe Bosh::Cli::Command::CloudFoundry do
|
|
67
70
|
command.stub(:director_client).and_return(director)
|
68
71
|
|
69
72
|
command.stub(:deployment).and_return(home_file("deployments/cf/demo.yml"))
|
70
|
-
command.biff.stub(:deployment).and_return(home_file("deployments/cf/demo.yml"))
|
71
73
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
it "generates a deployment file" do
|
79
|
-
in_home_dir do
|
80
|
-
File.should_not be_exist(command.deployment_file)
|
81
|
-
command.create_cf
|
82
|
-
File.should be_exist(command.deployment_file)
|
83
|
-
end
|
84
|
-
end
|
74
|
+
deployment_file = mock("deployment_file")
|
75
|
+
Bosh::Cloudfoundry::DeploymentFile.should_receive(:new).
|
76
|
+
and_return(deployment_file)
|
77
|
+
deployment_file.should_receive(:prepare_environment)
|
78
|
+
deployment_file.should_receive(:create_deployment_file)
|
79
|
+
deployment_file.should_receive(:deploy)
|
85
80
|
|
86
|
-
|
87
|
-
in_home_dir do
|
88
|
-
command.create_cf
|
89
|
-
manifest = YAML.load_file(command.deployment_file)
|
90
|
-
required_deployment_keys = %w[name director_uuid releases compilation update resource_pools jobs properties]
|
91
|
-
required_deployment_keys.each do |required_key|
|
92
|
-
manifest[required_key].should_not be_nil
|
93
|
-
end
|
94
|
-
end
|
81
|
+
command.create_cf
|
95
82
|
end
|
96
83
|
|
97
|
-
|
98
|
-
in_home_dir do
|
99
|
-
command.create_cf
|
100
|
-
manifest = YAML.load_file(command.deployment_file)
|
101
|
-
# invokes #err if any errors found
|
102
|
-
Bosh::Cli::DeploymentManifest.new(manifest).normalize
|
103
|
-
end
|
104
|
-
end
|
84
|
+
end
|
105
85
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
command.create_cf
|
110
|
-
end
|
111
|
-
end
|
86
|
+
it "displays the list of internal passwords" do
|
87
|
+
command.add_option(:config, home_file(".bosh_config"))
|
88
|
+
command.add_option(:non_interactive, true)
|
112
89
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
90
|
+
director = mock("director_client")
|
91
|
+
director.should_receive(:get_status).and_return({"uuid" => "UUID", "cpi" => "aws"})
|
92
|
+
command.stub(:director_client).and_return(director)
|
93
|
+
|
94
|
+
command.stub(:deployment).and_return(home_file("deployment.yml"))
|
95
|
+
File.open(home_file("deployment.yml"), "w") do |f|
|
96
|
+
f << {
|
97
|
+
"releases" => [
|
98
|
+
{"name" => "cf-release", "version" => 132}
|
99
|
+
],
|
100
|
+
"properties" => {
|
101
|
+
"cf" => {
|
102
|
+
"common_passwords" => "qwerty"
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}.to_yaml
|
120
106
|
end
|
121
|
-
|
107
|
+
command.show_cf_passwords
|
122
108
|
end
|
123
|
-
|
124
109
|
end
|
125
110
|
|
126
111
|
end
|