cf 0.6.1.rc12 → 0.6.1.rc13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cf/cli/organization/delete.rb +10 -21
- data/lib/cf/version.rb +1 -1
- data/lib/tunnel/helper-app/Gemfile +0 -1
- data/spec/cf/cli/organization/delete_spec.rb +80 -0
- data/spec/cf/cli/space/delete_spec.rb +1 -1
- data/spec/features/account_lifecycle_spec.rb +2 -0
- data/spec/features/push_flow_spec.rb +5 -5
- data/spec/support/features_helper.rb +5 -3
- metadata +55 -21
@@ -17,37 +17,26 @@ module CF::Organization
|
|
17
17
|
org = input[:organization]
|
18
18
|
return unless input[:really, org]
|
19
19
|
|
20
|
-
spaces = org.spaces
|
21
|
-
unless spaces.empty?
|
22
|
-
unless force?
|
23
|
-
line "This organization is not empty!"
|
24
|
-
line
|
25
|
-
line "spaces: #{name_list(spaces)}"
|
26
|
-
line
|
27
|
-
|
28
|
-
return unless input[:recursive]
|
29
|
-
end
|
30
|
-
|
31
|
-
spaces.each do |s|
|
32
|
-
invoke :delete_space, :space => s, :really => true,
|
33
|
-
:recursive => true, :warn => false
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
20
|
is_current = org == client.current_organization
|
38
21
|
|
39
|
-
|
40
|
-
org.
|
22
|
+
begin
|
23
|
+
with_progress("Deleting organization #{c(org.name, :name)}") do
|
24
|
+
org.delete!
|
25
|
+
end
|
26
|
+
rescue CFoundry::AssociationNotEmpty => boom
|
27
|
+
line
|
28
|
+
line c(boom.description, :bad)
|
29
|
+
line c("If you want to delete the organization along with all dependent objects, rerun the command with the #{b("'--recursive'")} flag.", :bad)
|
41
30
|
end
|
42
31
|
|
43
|
-
if
|
32
|
+
if client.organizations.size == 1
|
44
33
|
return unless input[:warn]
|
45
34
|
|
46
35
|
line
|
47
36
|
line c("There are no longer any organizations.", :warning)
|
48
37
|
line "You may want to create one with #{c("create-org", :good)}."
|
49
38
|
elsif is_current
|
50
|
-
|
39
|
+
invalidate_client
|
51
40
|
invoke :target
|
52
41
|
end
|
53
42
|
end
|
data/lib/cf/version.rb
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "cf/cli/organization/delete"
|
3
|
+
|
4
|
+
describe CF::Organization::Delete do
|
5
|
+
describe 'metadata' do
|
6
|
+
let(:command) { Mothership.commands[:delete_org] }
|
7
|
+
|
8
|
+
describe 'command' do
|
9
|
+
subject { command }
|
10
|
+
it { expect(Mothership::Help.group(:organizations)).to include(subject) }
|
11
|
+
end
|
12
|
+
|
13
|
+
include_examples 'inputs must have descriptions'
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "running the command" do
|
17
|
+
let(:organization) { fake(:organization, :name => "MyOrg") }
|
18
|
+
let(:organizations) { [organization] }
|
19
|
+
|
20
|
+
let(:client) { fake_client(:current_organization => organization, :organizations => organizations) }
|
21
|
+
|
22
|
+
subject { capture_output { cf %W[delete-org MyOrg --quiet --force] } }
|
23
|
+
|
24
|
+
before do
|
25
|
+
any_instance_of described_class do |cli|
|
26
|
+
stub(cli).client { client }
|
27
|
+
|
28
|
+
stub(cli).check_logged_in
|
29
|
+
stub(cli).check_target
|
30
|
+
any_instance_of(CF::Populators::Organization, :populate_and_save! => organization)
|
31
|
+
end
|
32
|
+
stub(organization).delete!
|
33
|
+
end
|
34
|
+
|
35
|
+
context "without the force parameter" do
|
36
|
+
subject { cf %W[delete-org MyOrg --quiet] }
|
37
|
+
it "confirms deletion of the organization and deletes it" do
|
38
|
+
mock(organization).delete!
|
39
|
+
mock_ask("Really delete #{organization.name}?", {:default => false}) { true }
|
40
|
+
|
41
|
+
subject
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context "when deleting the last organization" do
|
46
|
+
it "warns the user what they've done" do
|
47
|
+
subject
|
48
|
+
expect(output).to say("There are no longer any organizations.")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "when deleting the current organization" do
|
53
|
+
let(:organizations) { [organization, fake(:organization)] }
|
54
|
+
it "invalidates the old target / client" do
|
55
|
+
any_instance_of(described_class) { |cli| mock(cli).invalidate_client }
|
56
|
+
subject
|
57
|
+
end
|
58
|
+
|
59
|
+
it "invokes the target command" do
|
60
|
+
mock_invoke :target
|
61
|
+
subject
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "when an org fails to delete" do
|
66
|
+
before do
|
67
|
+
stub(organization).delete! { raise CFoundry::AssociationNotEmpty.new("We don't delete children.", 10006) }
|
68
|
+
subject
|
69
|
+
end
|
70
|
+
|
71
|
+
it "shows the error message" do
|
72
|
+
expect(output).to say "We don't delete children."
|
73
|
+
end
|
74
|
+
|
75
|
+
it "informs the user of how to recursively delete" do
|
76
|
+
expect(output).to say "If you want to delete the organization along with all dependent objects, rerun the command with the '--recursive' flag."
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -75,7 +75,7 @@ describe CF::Space::Delete do
|
|
75
75
|
|
76
76
|
context "when a space fails to delete" do
|
77
77
|
before do
|
78
|
-
stub(space).delete! { raise CFoundry::
|
78
|
+
stub(space).delete! { raise CFoundry::AssociationNotEmpty.new("We don't delete children.", 10006) }
|
79
79
|
subject
|
80
80
|
end
|
81
81
|
|
@@ -16,6 +16,8 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
16
16
|
let(:username) { ENV['CF_V2_TEST_USER'] }
|
17
17
|
let(:password) { ENV['CF_V2_TEST_PASSWORD'] }
|
18
18
|
let(:organization) { ENV['CF_V2_TEST_ORGANIZATION'] }
|
19
|
+
let(:space) { ENV['CF_V2_TEST_SPACE'] }
|
20
|
+
|
19
21
|
|
20
22
|
let(:client) do
|
21
23
|
client = CFoundry::V2::Client.new("https://#{target}")
|
@@ -64,13 +64,13 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
64
64
|
|
65
65
|
# create a service here
|
66
66
|
expect(runner).to say "What kind?>"
|
67
|
-
runner.send_keys "mysql
|
67
|
+
runner.send_keys "mysql n/a"
|
68
68
|
|
69
69
|
expect(runner).to say "Name?>"
|
70
70
|
runner.send_keys service_name
|
71
71
|
|
72
72
|
expect(runner).to say "Which plan?>"
|
73
|
-
runner.send_keys "
|
73
|
+
runner.send_keys "cfinternal"
|
74
74
|
|
75
75
|
expect(runner).to say /Creating service #{service_name}.*OK/
|
76
76
|
expect(runner).to say /Binding .+ to .+ OK/
|
@@ -98,9 +98,9 @@ if ENV['CF_V2_RUN_INTEGRATION']
|
|
98
98
|
expect(runner).to say /name\s+service\s+provider\s+version\s+plan\s+bound apps/
|
99
99
|
expect(runner).to say /mysql-.+?\s+ # name
|
100
100
|
mysql\s+ # service
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
aws\s+ # provider
|
102
|
+
n\/a\s+ # version
|
103
|
+
cfinternal\s+ # plan
|
104
104
|
#{app} # bound apps
|
105
105
|
/x
|
106
106
|
end
|
@@ -3,10 +3,12 @@ module FeaturesHelper
|
|
3
3
|
set_target
|
4
4
|
logout
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
to_space = respond_to?(:space) ? space : ENV['CF_V2_TEST_SPACE']
|
7
|
+
|
8
|
+
cmd = "#{cf_bin} login #{username} --password #{password} -o #{organization}"
|
9
|
+
cmd += " -s #{to_space}"
|
8
10
|
BlueShell::Runner.run(cmd) do |runner|
|
9
|
-
runner.wait_for_exit
|
11
|
+
runner.wait_for_exit 60
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.1.
|
4
|
+
version: 0.6.1.rc13
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-04-
|
13
|
+
date: 2013-04-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.7.0.
|
54
|
+
version: 0.7.0.rc5
|
55
55
|
- - <
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0.8'
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.7.0.
|
65
|
+
version: 0.7.0.rc5
|
66
66
|
- - <
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.8'
|
@@ -169,29 +169,29 @@ dependencies:
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '2.1'
|
171
171
|
- !ruby/object:Gem::Dependency
|
172
|
-
name:
|
172
|
+
name: blue-shell
|
173
173
|
requirement: !ruby/object:Gem::Requirement
|
174
174
|
none: false
|
175
175
|
requirements:
|
176
|
-
- -
|
176
|
+
- - '='
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version:
|
178
|
+
version: 0.0.3
|
179
179
|
type: :development
|
180
180
|
prerelease: false
|
181
181
|
version_requirements: !ruby/object:Gem::Requirement
|
182
182
|
none: false
|
183
183
|
requirements:
|
184
|
-
- -
|
184
|
+
- - '='
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
186
|
+
version: 0.0.3
|
187
187
|
- !ruby/object:Gem::Dependency
|
188
|
-
name:
|
188
|
+
name: fakefs
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
190
190
|
none: false
|
191
191
|
requirements:
|
192
192
|
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
194
|
+
version: 0.4.2
|
195
195
|
type: :development
|
196
196
|
prerelease: false
|
197
197
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -199,31 +199,31 @@ dependencies:
|
|
199
199
|
requirements:
|
200
200
|
- - ~>
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version:
|
202
|
+
version: 0.4.2
|
203
203
|
- !ruby/object:Gem::Dependency
|
204
|
-
name:
|
204
|
+
name: ffaker
|
205
205
|
requirement: !ruby/object:Gem::Requirement
|
206
206
|
none: false
|
207
207
|
requirements:
|
208
|
-
- -
|
208
|
+
- - ~>
|
209
209
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
210
|
+
version: '1.15'
|
211
211
|
type: :development
|
212
212
|
prerelease: false
|
213
213
|
version_requirements: !ruby/object:Gem::Requirement
|
214
214
|
none: false
|
215
215
|
requirements:
|
216
|
-
- -
|
216
|
+
- - ~>
|
217
217
|
- !ruby/object:Gem::Version
|
218
|
-
version:
|
218
|
+
version: '1.15'
|
219
219
|
- !ruby/object:Gem::Dependency
|
220
|
-
name:
|
220
|
+
name: rake
|
221
221
|
requirement: !ruby/object:Gem::Requirement
|
222
222
|
none: false
|
223
223
|
requirements:
|
224
224
|
- - ~>
|
225
225
|
- !ruby/object:Gem::Version
|
226
|
-
version: '
|
226
|
+
version: '0.9'
|
227
227
|
type: :development
|
228
228
|
prerelease: false
|
229
229
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -231,7 +231,7 @@ dependencies:
|
|
231
231
|
requirements:
|
232
232
|
- - ~>
|
233
233
|
- !ruby/object:Gem::Version
|
234
|
-
version: '
|
234
|
+
version: '0.9'
|
235
235
|
- !ruby/object:Gem::Dependency
|
236
236
|
name: rr
|
237
237
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +248,38 @@ dependencies:
|
|
248
248
|
- - ~>
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '1.0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: rspec
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
none: false
|
255
|
+
requirements:
|
256
|
+
- - ~>
|
257
|
+
- !ruby/object:Gem::Version
|
258
|
+
version: '2.11'
|
259
|
+
type: :development
|
260
|
+
prerelease: false
|
261
|
+
version_requirements: !ruby/object:Gem::Requirement
|
262
|
+
none: false
|
263
|
+
requirements:
|
264
|
+
- - ~>
|
265
|
+
- !ruby/object:Gem::Version
|
266
|
+
version: '2.11'
|
267
|
+
- !ruby/object:Gem::Dependency
|
268
|
+
name: webmock
|
269
|
+
requirement: !ruby/object:Gem::Requirement
|
270
|
+
none: false
|
271
|
+
requirements:
|
272
|
+
- - ~>
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
version: '1.9'
|
275
|
+
type: :development
|
276
|
+
prerelease: false
|
277
|
+
version_requirements: !ruby/object:Gem::Requirement
|
278
|
+
none: false
|
279
|
+
requirements:
|
280
|
+
- - ~>
|
281
|
+
- !ruby/object:Gem::Version
|
282
|
+
version: '1.9'
|
251
283
|
description:
|
252
284
|
email:
|
253
285
|
- vcap-dev@googlegroups.com
|
@@ -417,6 +449,7 @@ files:
|
|
417
449
|
- spec/cf/cli/app/stats_spec.rb
|
418
450
|
- spec/cf/cli/domain/map_spec.rb
|
419
451
|
- spec/cf/cli/domain/unmap_spec.rb
|
452
|
+
- spec/cf/cli/organization/delete_spec.rb
|
420
453
|
- spec/cf/cli/organization/orgs_spec.rb
|
421
454
|
- spec/cf/cli/organization/rename_spec.rb
|
422
455
|
- spec/cf/cli/populators/organization_spec.rb
|
@@ -481,7 +514,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
481
514
|
version: '0'
|
482
515
|
segments:
|
483
516
|
- 0
|
484
|
-
hash: -
|
517
|
+
hash: -3085176752358037272
|
485
518
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
486
519
|
none: false
|
487
520
|
requirements:
|
@@ -559,6 +592,7 @@ test_files:
|
|
559
592
|
- spec/cf/cli/app/stats_spec.rb
|
560
593
|
- spec/cf/cli/domain/map_spec.rb
|
561
594
|
- spec/cf/cli/domain/unmap_spec.rb
|
595
|
+
- spec/cf/cli/organization/delete_spec.rb
|
562
596
|
- spec/cf/cli/organization/orgs_spec.rb
|
563
597
|
- spec/cf/cli/organization/rename_spec.rb
|
564
598
|
- spec/cf/cli/populators/organization_spec.rb
|