cf 4.2.9.rc5 → 4.2.10.rc1
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/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
data/lib/cf/cli.rb
CHANGED
|
@@ -88,7 +88,6 @@ module CF
|
|
|
88
88
|
|
|
89
89
|
desc "Help!"
|
|
90
90
|
input :command, :argument => :optional
|
|
91
|
-
input :all, :type => :boolean
|
|
92
91
|
def help
|
|
93
92
|
if name = input[:command]
|
|
94
93
|
if cmd = @@commands[name.gsub("-", "_").to_sym]
|
|
@@ -97,11 +96,9 @@ module CF
|
|
|
97
96
|
unknown_command(name)
|
|
98
97
|
end
|
|
99
98
|
elsif Help.has_groups?
|
|
100
|
-
|
|
101
|
-
puts "#{help_header}"
|
|
102
|
-
end
|
|
99
|
+
puts "#{help_header}"
|
|
103
100
|
|
|
104
|
-
Mothership::Help.print_help_groups(@@global,
|
|
101
|
+
Mothership::Help.print_help_groups(@@global, true)
|
|
105
102
|
else
|
|
106
103
|
Mothership::Help.basic_help(@@commands, @@global)
|
|
107
104
|
end
|
|
@@ -110,7 +107,7 @@ module CF
|
|
|
110
107
|
def help_header
|
|
111
108
|
<<EOS
|
|
112
109
|
Cloud Foundry Command Line Interface, version [#{CF::VERSION}]
|
|
113
|
-
Use 'cf help
|
|
110
|
+
Use 'cf help [command]' for command details.
|
|
114
111
|
For docs and support visit http://support.cloudfoundry.com
|
|
115
112
|
|
|
116
113
|
USAGE EXAMPLES
|
data/lib/cf/cli/app/env.rb
CHANGED
|
@@ -5,7 +5,7 @@ module CF::App
|
|
|
5
5
|
VALID_ENV_VAR = /^[a-zA-Za-z_][[:alnum:]_]*$/
|
|
6
6
|
|
|
7
7
|
desc "Show all environment variables set for an app"
|
|
8
|
-
group :apps, :info
|
|
8
|
+
group :apps, :info
|
|
9
9
|
input :app, :desc => "Application to inspect the environment of",
|
|
10
10
|
:argument => true, :from_given => by_name(:app)
|
|
11
11
|
def env
|
|
@@ -24,7 +24,7 @@ module CF::App
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
desc "Set an environment variable"
|
|
27
|
-
group :apps, :info
|
|
27
|
+
group :apps, :info
|
|
28
28
|
input :app, :desc => "Application to set the variable for",
|
|
29
29
|
:argument => true, :from_given => by_name(:app)
|
|
30
30
|
input :name, :desc => "Variable name", :argument => true
|
|
@@ -56,7 +56,7 @@ module CF::App
|
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
desc "Remove an environment variable"
|
|
59
|
-
group :apps, :info
|
|
59
|
+
group :apps, :info
|
|
60
60
|
input :app, :desc => "Application to set the variable for",
|
|
61
61
|
:argument => true, :from_given => by_name(:app)
|
|
62
62
|
input :name, :desc => "Variable name", :argument => true
|
data/lib/cf/cli/app/events.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/app/base"
|
|
|
3
3
|
module CF::App
|
|
4
4
|
class Events < Base
|
|
5
5
|
desc "Display application events"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :app, :desc => "Application to get the events for",
|
|
8
8
|
:argument => true, :from_given => by_name(:app)
|
|
9
9
|
def events
|
data/lib/cf/cli/app/files.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "cf/cli/app/base"
|
|
|
4
4
|
module CF::App
|
|
5
5
|
class Files < Base
|
|
6
6
|
desc "Print out an app's file contents"
|
|
7
|
-
group :apps, :info
|
|
7
|
+
group :apps, :info
|
|
8
8
|
input :app, :desc => "Application to inspect the files of",
|
|
9
9
|
:argument => true, :from_given => by_name(:app)
|
|
10
10
|
input :path, :desc => "Path of file to read", :argument => :optional,
|
|
@@ -34,7 +34,7 @@ module CF::App
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
desc "Examine an app's files"
|
|
37
|
-
group :apps, :info
|
|
37
|
+
group :apps, :info
|
|
38
38
|
input :app, :desc => "Application to inspect the files of",
|
|
39
39
|
:argument => true, :from_given => by_name(:app)
|
|
40
40
|
input :path, :desc => "Path of directory to list", :argument => :optional,
|
|
@@ -62,7 +62,7 @@ module CF::App
|
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
desc "Stream an app's file contents"
|
|
65
|
-
group :apps, :info
|
|
65
|
+
group :apps, :info
|
|
66
66
|
input :app, :desc => "Application to inspect the files of",
|
|
67
67
|
:argument => true, :from_given => by_name(:app)
|
|
68
68
|
input :path, :desc => "Path of file to stream", :argument => :optional
|
data/lib/cf/cli/app/health.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/app/base"
|
|
|
3
3
|
module CF::App
|
|
4
4
|
class Health < Base
|
|
5
5
|
desc "Get application health"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :apps, :desc => "Show the health information for one or more applications", :argument => :splat,
|
|
8
8
|
:singular => :app, :from_given => by_name(:app)
|
|
9
9
|
def health
|
data/lib/cf/cli/app/instances.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/app/base"
|
|
|
3
3
|
module CF::App
|
|
4
4
|
class Instances < Base
|
|
5
5
|
desc "List an app's instances"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :apps, :desc => "Applications whose instances to list",
|
|
8
8
|
:argument => :splat, :singular => :app,
|
|
9
9
|
:from_given => by_name(:app)
|
data/lib/cf/cli/app/logs.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/app/base"
|
|
|
3
3
|
module CF::App
|
|
4
4
|
class Logs < Base
|
|
5
5
|
desc "Print out an app's logs"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :app, :desc => "Application to get the logs of", :argument => true,
|
|
8
8
|
:from_given => by_name(:app)
|
|
9
9
|
input :instance, :desc => "Instance of application to get the logs of",
|
|
@@ -33,7 +33,7 @@ module CF::App
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
desc "Print out the logs for an app's crashed instances"
|
|
36
|
-
group :apps, :info
|
|
36
|
+
group :apps, :info
|
|
37
37
|
input :app, :desc => "Application to get the logs of", :argument => true,
|
|
38
38
|
:from_given => by_name(:app)
|
|
39
39
|
def crashlogs
|
data/lib/cf/cli/app/rename.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/app/base"
|
|
|
3
3
|
module CF::App
|
|
4
4
|
class Rename < Base
|
|
5
5
|
desc "Rename an application"
|
|
6
|
-
group :apps, :manage
|
|
6
|
+
group :apps, :manage
|
|
7
7
|
input :app, :desc => "Application to rename", :argument => :optional,
|
|
8
8
|
:from_given => by_name(:app)
|
|
9
9
|
input :name, :desc => "New application name", :argument => :optional
|
data/lib/cf/cli/app/scale.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/app/base"
|
|
|
3
3
|
module CF::App
|
|
4
4
|
class Scale < Base
|
|
5
5
|
desc "Update the instances/memory limit for an application"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :app, :desc => "Application to update", :argument => true,
|
|
8
8
|
:from_given => by_name(:app)
|
|
9
9
|
input :instances, :desc => "Number of instances to run",
|
data/lib/cf/cli/app/stats.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/app/base"
|
|
|
3
3
|
module CF::App
|
|
4
4
|
class Stats < Base
|
|
5
5
|
desc "Display application instance status"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :app, :desc => "Application to get the stats for",
|
|
8
8
|
:argument => true, :from_given => by_name(:app)
|
|
9
9
|
def stats
|
|
@@ -3,7 +3,7 @@ require "cf/cli/organization/base"
|
|
|
3
3
|
module CF::Organization
|
|
4
4
|
class Rename < Base
|
|
5
5
|
desc "Rename an organization"
|
|
6
|
-
group :organizations
|
|
6
|
+
group :organizations
|
|
7
7
|
input :organization, :desc => "Organization to rename",
|
|
8
8
|
:aliases => ["--org", "-o"], :argument => :optional,
|
|
9
9
|
:from_given => by_name(:organization)
|
data/lib/cf/cli/route/map.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/route/base"
|
|
|
3
3
|
module CF::Route
|
|
4
4
|
class Map < Base
|
|
5
5
|
desc "Add a URL mapping"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :app, :desc => "Application to add the URL to",
|
|
8
8
|
:argument => :optional, :from_given => by_name(:app)
|
|
9
9
|
input :host, :desc => "Host name for the route",
|
data/lib/cf/cli/route/unmap.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/route/base"
|
|
|
3
3
|
module CF::Route
|
|
4
4
|
class Unmap < Base
|
|
5
5
|
desc "Remove a URL mapping"
|
|
6
|
-
group :apps, :info
|
|
6
|
+
group :apps, :info
|
|
7
7
|
input :url, :desc => "URL to unmap", :argument => :optional,
|
|
8
8
|
:from_given => find_by_name("route") { client.routes }
|
|
9
9
|
input :app, :desc => "Application to remove the URL from",
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
require "cf/cli/service/base"
|
|
2
2
|
|
|
3
3
|
module CF::Service
|
|
4
|
-
USER_PROVIDED_OFFERING = "user-provided" # I'd rather move this to CFoundry
|
|
5
|
-
|
|
6
|
-
class UPDummy
|
|
7
|
-
def label
|
|
8
|
-
"user-provided"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
attr_reader :version, :provider
|
|
12
|
-
end
|
|
13
|
-
|
|
14
4
|
class Create < Base
|
|
15
5
|
offerings_from_label = proc { |label, offerings|
|
|
16
6
|
offerings.select { |s| s.label == label }
|
|
@@ -56,8 +46,6 @@ module CF::Service
|
|
|
56
46
|
end
|
|
57
47
|
finalize
|
|
58
48
|
|
|
59
|
-
offerings << UPDummy.new
|
|
60
|
-
|
|
61
49
|
selected_offerings = offerings.any? ? Array(input[:offering, offerings.sort_by(&:label)]) : []
|
|
62
50
|
finalize
|
|
63
51
|
|
|
@@ -67,85 +55,48 @@ module CF::Service
|
|
|
67
55
|
|
|
68
56
|
offering = selected_offerings.first
|
|
69
57
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
service_instance.service_plan = if plan.is_a?(String)
|
|
85
|
-
offering.service_plans.find { |p| p.name.casecmp(plan) == 0 }
|
|
86
|
-
else
|
|
87
|
-
plan
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
service_instance.space = client.current_space
|
|
92
|
-
|
|
93
|
-
with_progress("Creating service #{c(service_instance.name, :name)}") do
|
|
94
|
-
service_instance.create!
|
|
58
|
+
service = client.service_instance
|
|
59
|
+
service.name = input[:name, offering]
|
|
60
|
+
finalize
|
|
61
|
+
plan = input[:plan, offering.service_plans]
|
|
62
|
+
finalize
|
|
63
|
+
service.service_plan = if plan.is_a?(String)
|
|
64
|
+
offering.service_plans.find { |p| p.name.casecmp(plan) == 0 }
|
|
65
|
+
else
|
|
66
|
+
plan
|
|
67
|
+
end
|
|
68
|
+
service.space = client.current_space
|
|
69
|
+
|
|
70
|
+
with_progress("Creating service #{c(service.name, :name)}") do
|
|
71
|
+
service.create!
|
|
95
72
|
end
|
|
96
73
|
|
|
97
74
|
app = input[:app]
|
|
98
75
|
finalize
|
|
99
76
|
|
|
100
77
|
if app
|
|
101
|
-
invoke :bind_service, :service =>
|
|
78
|
+
invoke :bind_service, :service => service, :app => app
|
|
102
79
|
end
|
|
103
|
-
|
|
80
|
+
service
|
|
104
81
|
end
|
|
105
82
|
|
|
106
83
|
private
|
|
107
84
|
|
|
108
|
-
def ask_credentials
|
|
109
|
-
credentials = {}
|
|
110
|
-
line("What credential parameters should applications use to connect to this service instance? (e.g. hostname, port, password)")
|
|
111
|
-
|
|
112
|
-
while keys = ask("Keys").split(/\s*,\s*/).map(&:strip)
|
|
113
|
-
if bad_key = keys.detect { |key| key !~ /^[-\w]+$/ }
|
|
114
|
-
line("'#{bad_key}' is not a valid key")
|
|
115
|
-
else
|
|
116
|
-
break
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
finalize
|
|
120
|
-
keys.each do |key|
|
|
121
|
-
value = ask(key)
|
|
122
|
-
finalize
|
|
123
|
-
credentials[key] = value
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
credentials
|
|
127
|
-
end
|
|
128
|
-
|
|
129
85
|
def ask_offering(offerings)
|
|
130
86
|
[ask("What kind?", :choices => offerings.sort_by(&:label),
|
|
131
|
-
:display => proc
|
|
87
|
+
:display => proc { |s|
|
|
132
88
|
str = "#{c(s.label, :name)} #{s.version}"
|
|
133
89
|
if s.provider != "core"
|
|
134
90
|
str << ", via #{s.provider}"
|
|
135
91
|
end
|
|
136
92
|
str
|
|
137
|
-
|
|
93
|
+
},
|
|
138
94
|
:complete => proc { |s| "#{s.label} #{s.version}" })]
|
|
139
95
|
end
|
|
140
96
|
|
|
141
97
|
def ask_name(offering)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
random = sprintf("%x", rand(1000000))
|
|
145
|
-
default = "#{offering.label}-#{random}"
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
ask "Name?", :default => default
|
|
98
|
+
random = sprintf("%x", rand(1000000))
|
|
99
|
+
ask "Name?", :default => "#{offering.label}-#{random}"
|
|
149
100
|
end
|
|
150
101
|
|
|
151
102
|
def ask_plan(plans)
|
|
@@ -4,7 +4,7 @@ module CF::Service
|
|
|
4
4
|
class Delete < Base
|
|
5
5
|
desc "Delete a service"
|
|
6
6
|
group :services, :manage
|
|
7
|
-
input :service, :desc => "Service to
|
|
7
|
+
input :service, :desc => "Service to bind", :argument => :optional,
|
|
8
8
|
:from_given => by_name(:service_instance, :service)
|
|
9
9
|
input :unbind, :desc => "Unbind from applications before deleting?",
|
|
10
10
|
:type => :boolean, :default => proc { force? || interact }
|
|
@@ -3,7 +3,7 @@ require "cf/cli/service/base"
|
|
|
3
3
|
module CF::Service
|
|
4
4
|
class Rename < Base
|
|
5
5
|
desc "Rename a service"
|
|
6
|
-
group :services, :manage
|
|
6
|
+
group :services, :manage
|
|
7
7
|
input :service, :desc => "Service to rename", :argument => :optional,
|
|
8
8
|
:from_given => by_name(:service_instance, :service)
|
|
9
9
|
input :name, :desc => "New service name", :argument => :optional
|
|
@@ -71,16 +71,19 @@ module CF::Service
|
|
|
71
71
|
def show_services_table
|
|
72
72
|
table(
|
|
73
73
|
["name", "service", "provider", "version", "plan", "bound apps"],
|
|
74
|
-
@services.collect { |
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
@services.collect { |i|
|
|
75
|
+
apps = name_list(i.service_bindings.collect(&:app))
|
|
76
|
+
plan = i.service_plan
|
|
77
|
+
|
|
78
|
+
unless plan
|
|
79
|
+
[ c(i.name, :name), "none", "none", "none", "none", apps]
|
|
80
|
+
else
|
|
81
|
+
service = plan.service
|
|
82
|
+
label = service.label
|
|
83
|
+
version = service.version
|
|
84
|
+
provider = service.provider
|
|
85
|
+
[ c(i.name, :name), label, provider, version, plan.name, apps]
|
|
86
|
+
end
|
|
84
87
|
})
|
|
85
88
|
|
|
86
89
|
end
|
|
@@ -102,8 +105,25 @@ module CF::Service
|
|
|
102
105
|
return false unless File.fnmatch(name, i.name)
|
|
103
106
|
end
|
|
104
107
|
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
plan = i.service_plan
|
|
109
|
+
|
|
110
|
+
if service = options[:service]
|
|
111
|
+
return false unless File.fnmatch(service, plan.service.label)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if plan = options[:plan]
|
|
115
|
+
return false unless File.fnmatch(plan.upcase, plan.name.upcase)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if provider = options[:provider]
|
|
119
|
+
return false unless File.fnmatch(provider, plan.service.provider)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if version = options[:version]
|
|
123
|
+
return false unless File.fnmatch(version, plan.service.version)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
true
|
|
107
127
|
end
|
|
108
128
|
end
|
|
109
129
|
end
|
data/lib/cf/cli/space/rename.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/space/base"
|
|
|
3
3
|
module CF::Space
|
|
4
4
|
class Rename < Base
|
|
5
5
|
desc "Rename a space"
|
|
6
|
-
group :spaces
|
|
6
|
+
group :spaces
|
|
7
7
|
input :organization, :desc => "Space's organization",
|
|
8
8
|
:aliases => ["--org", "-o"], :from_given => by_name(:organization),
|
|
9
9
|
:default => proc { client.current_organization }
|
data/lib/cf/cli/space/switch.rb
CHANGED
data/lib/cf/cli/start/colors.rb
CHANGED
data/lib/cf/cli/start/targets.rb
CHANGED
data/lib/cf/cli/user/create.rb
CHANGED
|
@@ -3,7 +3,7 @@ require "cf/cli/user/base"
|
|
|
3
3
|
module CF::User
|
|
4
4
|
class Create < Base
|
|
5
5
|
desc "Create a user"
|
|
6
|
-
group :admin, :user
|
|
6
|
+
group :admin, :user
|
|
7
7
|
input :email, :desc => "User email", :argument => :optional
|
|
8
8
|
input :password, :desc => "User password"
|
|
9
9
|
input :verify, :desc => "Repeat password"
|