cf 4.2.9.rc5 → 4.2.10.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cf/cli.rb +3 -6
- data/lib/cf/cli/app/env.rb +3 -3
- data/lib/cf/cli/app/events.rb +1 -1
- data/lib/cf/cli/app/files.rb +3 -3
- data/lib/cf/cli/app/health.rb +1 -1
- data/lib/cf/cli/app/instances.rb +1 -1
- data/lib/cf/cli/app/logs.rb +2 -2
- data/lib/cf/cli/app/rename.rb +1 -1
- data/lib/cf/cli/app/scale.rb +1 -1
- data/lib/cf/cli/app/stats.rb +1 -1
- data/lib/cf/cli/organization/rename.rb +1 -1
- data/lib/cf/cli/route/map.rb +1 -1
- data/lib/cf/cli/route/unmap.rb +1 -1
- data/lib/cf/cli/service/create.rb +20 -69
- data/lib/cf/cli/service/delete.rb +1 -1
- data/lib/cf/cli/service/rename.rb +1 -1
- data/lib/cf/cli/service/services.rb +32 -12
- data/lib/cf/cli/space/rename.rb +1 -1
- data/lib/cf/cli/space/switch.rb +1 -1
- data/lib/cf/cli/start/colors.rb +1 -1
- data/lib/cf/cli/start/targets.rb +1 -1
- data/lib/cf/cli/user/create.rb +1 -1
- data/lib/cf/cli/user/passwd.rb +1 -1
- data/lib/cf/cli/user/register.rb +1 -1
- data/lib/cf/cli/user/users.rb +1 -1
- data/lib/cf/version.rb +1 -1
- data/lib/manifests/manifests.rb +25 -41
- data/lib/tasks/gem_release.rake +2 -2
- data/spec/cf/cli/app/delete_spec.rb +2 -2
- data/spec/cf/cli/app/push/create_spec.rb +1 -1
- data/spec/cf/cli/service/create_spec.rb +4 -52
- data/spec/cf/cli/service/rename_spec.rb +1 -1
- data/spec/cf/cli/service/services_spec.rb +34 -63
- data/spec/cf/cli/space/space_spec.rb +1 -1
- data/spec/cf/cli/space/spaces_spec.rb +3 -3
- data/spec/factories/cfoundry/v2/{managed_service_instances_factory.rb → service_instances_factory.rb} +2 -2
- data/spec/features/services_spec.rb +0 -96
- data/spec/integration/push_flow_spec.rb +1 -26
- data/spec/manifests/manifests_spec.rb +25 -46
- data/spec/support/features_helper.rb +3 -36
- data/spec/support/matchers.rb +3 -14
- metadata +66 -24
- checksums.yaml +0 -7
- data/lib/cf/cli/service/service_instance_helper.rb +0 -99
- data/spec/assets/env/Gemfile +0 -4
- data/spec/assets/env/Gemfile.lock +0 -17
- data/spec/assets/env/env_test.rb +0 -58
- data/spec/assets/hello-sinatra/manifest.yml +0 -17
- data/spec/cf/cli/service/service_instance_helper_spec.rb +0 -155
- data/spec/factories/cfoundry/v2/user_provided_service_instances_factory.rb +0 -12
- data/spec/features/manifests_spec.rb +0 -86
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: e4e2f3033d9d821a41f9ddc7f2dbeab8de538317
|
4
|
-
data.tar.gz: b6aa6ef1017ce73a108cac2dcf560a443c82882c
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 5df73a8dd292d078af3679f56f1729415af83706513028997a7d9264fbef9dda9c96feae5422e1e138a93879e87621258a3128acd59b7574e7a9bff0f74d7329
|
7
|
-
data.tar.gz: 26a10354a3e832f2a395c18f2f7d090d09675ac648bd298e56220157f7aaf53308163611d74f6d856225bc3a1712a62bf8b7d332e684ff122fa27e7e283ecbfc
|
@@ -1,99 +0,0 @@
|
|
1
|
-
class ServiceInstanceHelper
|
2
|
-
def self.new(instance)
|
3
|
-
"#{instance.class.name.demodulize}Helper".constantize.new(instance)
|
4
|
-
end
|
5
|
-
end
|
6
|
-
|
7
|
-
class UserProvidedServiceInstanceHelper
|
8
|
-
def initialize(instance)
|
9
|
-
@instance = instance
|
10
|
-
end
|
11
|
-
|
12
|
-
def service_label
|
13
|
-
"user-provided"
|
14
|
-
end
|
15
|
-
|
16
|
-
def service_provider
|
17
|
-
"n/a"
|
18
|
-
end
|
19
|
-
|
20
|
-
def version
|
21
|
-
"n/a"
|
22
|
-
end
|
23
|
-
|
24
|
-
def plan_name
|
25
|
-
"n/a"
|
26
|
-
end
|
27
|
-
|
28
|
-
def matches(opts = {})
|
29
|
-
label = opts[:service]
|
30
|
-
if label
|
31
|
-
return label == service_label
|
32
|
-
end
|
33
|
-
|
34
|
-
true
|
35
|
-
end
|
36
|
-
|
37
|
-
def name
|
38
|
-
@instance.name
|
39
|
-
end
|
40
|
-
|
41
|
-
def service_bindings
|
42
|
-
@instance.service_bindings
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
class ManagedServiceInstanceHelper
|
47
|
-
def initialize(service_instance)
|
48
|
-
@instance = service_instance
|
49
|
-
end
|
50
|
-
|
51
|
-
def service_label
|
52
|
-
@instance.service_plan.service.label
|
53
|
-
end
|
54
|
-
|
55
|
-
def service_provider
|
56
|
-
@instance.service_plan.service.provider
|
57
|
-
end
|
58
|
-
|
59
|
-
def version
|
60
|
-
@instance.service_plan.service.version
|
61
|
-
end
|
62
|
-
|
63
|
-
def plan_name
|
64
|
-
@instance.service_plan.name
|
65
|
-
end
|
66
|
-
|
67
|
-
def service_bindings
|
68
|
-
@instance.service_bindings
|
69
|
-
end
|
70
|
-
|
71
|
-
def name
|
72
|
-
@instance.name
|
73
|
-
end
|
74
|
-
|
75
|
-
def matches(opts = {})
|
76
|
-
service = opts[:service]
|
77
|
-
plan = opts[:plan]
|
78
|
-
provider = opts[:provider]
|
79
|
-
version = opts[:version]
|
80
|
-
|
81
|
-
if service
|
82
|
-
return false unless File.fnmatch(service, service_label)
|
83
|
-
end
|
84
|
-
|
85
|
-
if plan
|
86
|
-
return false unless File.fnmatch(plan.upcase, plan_name.upcase)
|
87
|
-
end
|
88
|
-
|
89
|
-
if provider
|
90
|
-
return false unless File.fnmatch(provider, service_provider)
|
91
|
-
end
|
92
|
-
|
93
|
-
if version
|
94
|
-
return false unless File.fnmatch(version, self.version)
|
95
|
-
end
|
96
|
-
|
97
|
-
true
|
98
|
-
end
|
99
|
-
end
|
data/spec/assets/env/Gemfile
DELETED
data/spec/assets/env/env_test.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
require 'sinatra'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
$stdout.sync = true
|
7
|
-
|
8
|
-
def dump_env(fmt)
|
9
|
-
if fmt == 'html' || fmt == nil
|
10
|
-
res = ''
|
11
|
-
ENV.each do |k, v|
|
12
|
-
res << "#{k}: #{v}<br/>"
|
13
|
-
end
|
14
|
-
res
|
15
|
-
elsif fmt == 'json'
|
16
|
-
res = {}
|
17
|
-
ENV.each do |k, v|
|
18
|
-
res[k] = v
|
19
|
-
end
|
20
|
-
puts res
|
21
|
-
res.to_json
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
get '/' do
|
26
|
-
dump_env('html')
|
27
|
-
end
|
28
|
-
|
29
|
-
get '/healthcheck' do
|
30
|
-
"OK"
|
31
|
-
end
|
32
|
-
|
33
|
-
get '/env' do
|
34
|
-
dump_env('json')
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
get '/services' do
|
39
|
-
app_instance = JSON.parse(ENV['VCAP_APPLICATION'])
|
40
|
-
services = JSON.parse(ENV['VCAP_SERVICES'])
|
41
|
-
|
42
|
-
valid_services = false
|
43
|
-
service_list = []
|
44
|
-
services.each do |k, v|
|
45
|
-
v.each do |i|
|
46
|
-
s = {}
|
47
|
-
s['vendor'] = k.split('-')[0]
|
48
|
-
s['name'] = i['name']
|
49
|
-
service_list << s
|
50
|
-
valid_services = true
|
51
|
-
end
|
52
|
-
end
|
53
|
-
response = "{\"status\":\"ok\", \"services\": #{service_list.to_json}}" if valid_services
|
54
|
-
response = "{\"status\":\"fail\", \"services\": []}" if !valid_services
|
55
|
-
|
56
|
-
puts "my response: #{response}"
|
57
|
-
response
|
58
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
---
|
2
|
-
applications:
|
3
|
-
- name: hello-sinatra-1375741878_010056
|
4
|
-
memory: 256M
|
5
|
-
instances: 1
|
6
|
-
host: hello-sinatra-subdomain-1375741878_010056
|
7
|
-
domain: a1-app.cf-app.com
|
8
|
-
path: .
|
9
|
-
services:
|
10
|
-
user-provided-1375741878_010056:
|
11
|
-
label: user-provided
|
12
|
-
credentials:
|
13
|
-
username: abc123
|
14
|
-
password: sunshine
|
15
|
-
hostname: oracle.enterprise.com
|
16
|
-
port: 1234
|
17
|
-
name: myoracledb2
|
@@ -1,155 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ServiceInstanceHelper do
|
4
|
-
describe ".new" do
|
5
|
-
let(:provided_instance) { build(:user_provided_service_instance) }
|
6
|
-
let(:managed_instance) { build(:managed_service_instance) }
|
7
|
-
|
8
|
-
it "returns a ManagedSerivceInstanceHelper when the argument is a ManagedServiceInstance" do
|
9
|
-
expect(ServiceInstanceHelper.new(managed_instance)).to be_a ManagedServiceInstanceHelper
|
10
|
-
end
|
11
|
-
|
12
|
-
it "returns a ManagedSerivceInstanceHelper when the argument is a ManagedServiceInstance" do
|
13
|
-
expect(ServiceInstanceHelper.new(provided_instance)).to be_a UserProvidedServiceInstanceHelper
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
describe UserProvidedServiceInstanceHelper do
|
19
|
-
let(:bindings) { [] }
|
20
|
-
let(:instance) { build(:user_provided_service_instance, service_bindings: bindings) }
|
21
|
-
subject(:helper) { UserProvidedServiceInstanceHelper.new(instance) }
|
22
|
-
describe "matches" do
|
23
|
-
it "returns true when 'user-provided' is the given label" do
|
24
|
-
expect(helper.matches(service: "user-provided")).to eq true
|
25
|
-
end
|
26
|
-
|
27
|
-
it "returns false when 'user-provided' is not the given label" do
|
28
|
-
expect(helper.matches(service: "a-different-label")).to eq false
|
29
|
-
end
|
30
|
-
|
31
|
-
it "returns true when a label is not given" do
|
32
|
-
expect(helper.matches).to eq true
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
its(:service_label) { should eq("user-provided") }
|
37
|
-
its(:service_provider) { should eq("n/a") }
|
38
|
-
its(:version) { should eq("n/a") }
|
39
|
-
its(:plan_name) { should eq("n/a") }
|
40
|
-
its(:name) { should eq instance.name }
|
41
|
-
its(:service_bindings) { should eq instance.service_bindings }
|
42
|
-
end
|
43
|
-
|
44
|
-
describe ManagedServiceInstanceHelper do
|
45
|
-
let(:label) { "some-label" }
|
46
|
-
let(:provider) { "some-provider" }
|
47
|
-
let(:version) { "some-version" }
|
48
|
-
let(:plan_name) { "some-plan-name" }
|
49
|
-
|
50
|
-
let(:service) { build(:service, label: label, provider: provider, version: version) }
|
51
|
-
let(:plan) { build(:service_plan, service: service, name: plan_name) }
|
52
|
-
let(:bindings) { [] }
|
53
|
-
let(:instance) { build(:managed_service_instance, service_plan: plan, service_bindings: bindings) }
|
54
|
-
subject(:helper) { ManagedServiceInstanceHelper.new(instance) }
|
55
|
-
|
56
|
-
describe "matches" do
|
57
|
-
it "returns true when no condition is specified" do
|
58
|
-
expect(helper.matches).to eq(true)
|
59
|
-
end
|
60
|
-
|
61
|
-
context "filtering based on service" do
|
62
|
-
it "returns true if the service label matches given service" do
|
63
|
-
expect(helper.matches(service: label)).to eq(true)
|
64
|
-
end
|
65
|
-
|
66
|
-
it "returns false if the service label does not match given service" do
|
67
|
-
expect(helper.matches(service: "a-different-label")).to eq(false)
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context "filtering based on service plan" do
|
72
|
-
it "returns true if the plan name matches given plan" do
|
73
|
-
expect(helper.matches(plan: plan_name)).to eq(true)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "returns true if the plan name does not match given plan" do
|
77
|
-
expect(helper.matches(plan: "some-other-plan-name")).to eq(false)
|
78
|
-
end
|
79
|
-
|
80
|
-
it "is case insensitive" do
|
81
|
-
expect(helper.matches(plan: plan_name.upcase)).to eq(true)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context "filtering based on provider" do
|
86
|
-
it "returns true if the provider name matches given provider" do
|
87
|
-
expect(helper.matches(provider: provider)).to eq(true)
|
88
|
-
end
|
89
|
-
|
90
|
-
it "returns true if the provider does not match given provider" do
|
91
|
-
expect(helper.matches(provider: "a-different-provider")).to eq(false)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
context "filtering based on version" do
|
96
|
-
it "returns true if the version matches given version" do
|
97
|
-
expect(helper.matches(version: version)).to eq(true)
|
98
|
-
end
|
99
|
-
|
100
|
-
it "returns true if the version does not match given version" do
|
101
|
-
expect(helper.matches(version: "a-different-version")).to eq(false)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context "multiple filters" do
|
106
|
-
it "returns true if the service instance matches all four parameters" do
|
107
|
-
expect(helper.matches(service: label, plan: plan_name,
|
108
|
-
provider: provider, version: version)).to eq true
|
109
|
-
end
|
110
|
-
|
111
|
-
it "return false if any of the parameters does not match the attribute of the service instance" do
|
112
|
-
expect(helper.matches(service: label, plan: plan_name,
|
113
|
-
provider: provider, version: "a-different-version")).to eq false
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
context "with patterns for args" do
|
118
|
-
it "returns true when service label matches the given glob" do
|
119
|
-
expect(helper.matches(service: label.gsub(/.$/, "*"))).to eq(true)
|
120
|
-
end
|
121
|
-
|
122
|
-
it "returns false when the service label doesn not match the given glob" do
|
123
|
-
expect(helper.matches(service: label + "_*")).to eq(false)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe "service_label" do
|
129
|
-
|
130
|
-
it "returns the label of instance's service offering" do
|
131
|
-
expect(helper.service_label).to eq label
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
describe "service_provider" do
|
136
|
-
it "returns the provider of the instance's service offering" do
|
137
|
-
expect(helper.service_provider).to eq provider
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe "version" do
|
142
|
-
it "returns the version of the instance's service offering" do
|
143
|
-
expect(helper.version).to eq version
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
describe "plan_name" do
|
148
|
-
it "returns the name of the instance's service plan" do
|
149
|
-
expect(helper.plan_name).to eq plan_name
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
its(:name) { should eq instance.name }
|
154
|
-
its(:service_bindings) { should eq instance.service_bindings }
|
155
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
factory :user_provided_service_instance, :class => CFoundry::V2::UserProvidedServiceInstance do
|
3
|
-
sequence(:guid) { |n| "user-provided-service-instance-guid-#{n}" }
|
4
|
-
sequence(:name) { |n| "user-provided-service-instance-name-#{n}" }
|
5
|
-
|
6
|
-
ignore do
|
7
|
-
client { FactoryGirl.build(:client) }
|
8
|
-
end
|
9
|
-
|
10
|
-
initialize_with { new(guid, client) }
|
11
|
-
end
|
12
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "webmock/rspec"
|
3
|
-
|
4
|
-
if ENV["CF_V2_RUN_INTEGRATION"]
|
5
|
-
describe "A user pushing a new sinatra app" do
|
6
|
-
|
7
|
-
let(:run_id) { TRAVIS_BUILD_ID.to_s + Time.new.to_f.to_s.gsub(".", "_") }
|
8
|
-
let(:app) { "hello-sinatra-#{run_id}" }
|
9
|
-
let(:subdomain) { "hello-sinatra-subdomain-#{run_id}" }
|
10
|
-
let(:user_provided_name) { "user-provided-#{run_id}"}
|
11
|
-
|
12
|
-
before do
|
13
|
-
FileUtils.rm_rf File.expand_path(CF::CONFIG_DIR)
|
14
|
-
WebMock.allow_net_connect!
|
15
|
-
login
|
16
|
-
end
|
17
|
-
|
18
|
-
after do
|
19
|
-
`#{cf_bin} unbind-service -f --no-script #{user_provided_name} #{app}`
|
20
|
-
`#{cf_bin} delete-service -f --no-script #{user_provided_name}`
|
21
|
-
|
22
|
-
`#{cf_bin} delete #{app} -f --routes --no-script`
|
23
|
-
logout
|
24
|
-
end
|
25
|
-
|
26
|
-
context "with user-provided service" do
|
27
|
-
it "reads the manifest when pushing" do
|
28
|
-
Dir.chdir("#{SPEC_ROOT}/assets/hello-sinatra") do
|
29
|
-
FileUtils.rm("manifest.yml", force: true)
|
30
|
-
File.open("manifest.yml", "w") do |f|
|
31
|
-
f.write(<<-MANIFEST)
|
32
|
-
---
|
33
|
-
applications:
|
34
|
-
- name: #{app}
|
35
|
-
memory: 256M
|
36
|
-
instances: 1
|
37
|
-
host: #{subdomain}
|
38
|
-
domain: a1-app.cf-app.com
|
39
|
-
path: .
|
40
|
-
services:
|
41
|
-
#{user_provided_name}:
|
42
|
-
label: user-provided
|
43
|
-
credentials:
|
44
|
-
username: abc123
|
45
|
-
password: sunshine
|
46
|
-
hostname: oracle.enterprise.com
|
47
|
-
port: 1234
|
48
|
-
name: myoracledb2
|
49
|
-
MANIFEST
|
50
|
-
end
|
51
|
-
|
52
|
-
BlueShell::Runner.run("#{cf_bin} push") do |runner|
|
53
|
-
expect(runner).to say "Using manifest file manifest.yml"
|
54
|
-
expect(runner).to say "Creating #{app}... OK"
|
55
|
-
|
56
|
-
expect(runner).to say(/Creating route #{subdomain}\..*\.\.\. OK/)
|
57
|
-
expect(runner).to say(/Binding #{subdomain}\..* to #{app}\.\.\. OK/)
|
58
|
-
|
59
|
-
expect(runner).to say /Creating service #{user_provided_name}.*OK/
|
60
|
-
expect(runner).to say /Binding #{user_provided_name} to #{app}... OK/
|
61
|
-
|
62
|
-
expect(runner).to say "Uploading #{app}... OK", 180
|
63
|
-
expect(runner).to say "Preparing to start #{app}... OK", 180
|
64
|
-
expect(runner).to say "Checking status of app '#{app}'...", 180
|
65
|
-
expect(runner).to say "1 of 1 instances running"
|
66
|
-
expect(runner).to say "Push successful! App '#{app}' available at http://#{subdomain}.a1-app.cf-app.com", 30
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
BlueShell::Runner.run("#{cf_bin} services") do |runner|
|
71
|
-
expect(runner).to say /name\s+service\s+provider\s+version\s+plan\s+bound apps/
|
72
|
-
expect(runner).to say /#{user_provided_name}\s+ # name
|
73
|
-
user-provided\s+ # service
|
74
|
-
n\/a\s+ # provider
|
75
|
-
n\/a\s+ # version
|
76
|
-
n\/a\s+ # plan
|
77
|
-
#{app} # bound apps
|
78
|
-
/x
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
else
|
85
|
-
$stderr.puts 'Skipping v2 integration specs; please provide necessary environment variables'
|
86
|
-
end
|