rhc 1.13.6 → 1.14.7
Sign up to get free protection for your applications and to get access to all the features.
- data/features/env.feature +35 -0
- data/features/lib/rhc_helper.rb +1 -0
- data/features/lib/rhc_helper/commandify.rb +25 -3
- data/features/lib/rhc_helper/env.rb +29 -0
- data/features/step_definitions/env_steps.rb +31 -0
- data/features/support/platform_support.rb +3 -13
- data/lib/rhc/cartridge_helpers.rb +4 -2
- data/lib/rhc/commands.rb +5 -1
- data/lib/rhc/commands/app.rb +25 -17
- data/lib/rhc/commands/cartridge.rb +23 -21
- data/lib/rhc/commands/domain.rb +14 -14
- data/lib/rhc/commands/snapshot.rb +1 -1
- data/lib/rhc/helpers.rb +12 -10
- data/lib/rhc/rest/application.rb +4 -0
- data/lib/rhc/rest/client.rb +16 -9
- data/lib/rhc/rest/domain.rb +4 -0
- data/lib/rhc/rest/httpclient.rb +20 -0
- data/lib/rhc/rest/mock.rb +3 -2
- data/lib/rhc/tar_gz.rb +1 -1
- data/lib/rhc/wizard.rb +11 -10
- data/spec/rhc/cli_spec.rb +24 -2
- data/spec/rhc/commands/app_spec.rb +23 -4
- data/spec/rhc/commands/cartridge_spec.rb +20 -21
- data/spec/rhc/commands/domain_spec.rb +2 -2
- data/spec/rhc/commands/snapshot_spec.rb +2 -2
- data/spec/rhc/helpers_spec.rb +4 -1
- data/spec/rhc/rest_application_spec.rb +3 -3
- data/spec/rhc/rest_client_spec.rb +8 -8
- data/spec/rhc/rest_spec.rb +9 -1
- data/spec/rhc/wizard_spec.rb +5 -5
- data/spec/wizard_spec_helper.rb +6 -6
- metadata +7 -5
data/features/env.feature
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
@env_var @domain_required
|
2
|
+
Feature: Environment Variables Operations
|
3
|
+
|
4
|
+
# @init
|
5
|
+
# Scenario: Application Creation
|
6
|
+
# When a php application is created
|
7
|
+
# Then the application should be accessible
|
8
|
+
|
9
|
+
Scenario: Environment variable is set
|
10
|
+
Given a php application is created
|
11
|
+
And the application should be accessible
|
12
|
+
When a new environment variable "FOO" is set as "BAR"
|
13
|
+
And the existing environment variables are listed
|
14
|
+
Then the output environment variables include "FOO=BAR"
|
15
|
+
|
16
|
+
Scenario: Environment variables are set
|
17
|
+
Given a php application is created
|
18
|
+
And the application should be accessible
|
19
|
+
When a new environment variable "FOO" is set as "BAR"
|
20
|
+
And a new environment variable "FOO2" is set as "BAR2"
|
21
|
+
And the existing environment variables are listed
|
22
|
+
Then the output environment variables include "FOO=BAR"
|
23
|
+
And the output environment variables include "FOO2=BAR2"
|
24
|
+
|
25
|
+
Scenario: Environment variable is unset
|
26
|
+
Given a php application is created
|
27
|
+
And the application should be accessible
|
28
|
+
When a new environment variable "FOO" is set as "BAR"
|
29
|
+
And the existing environment variables are listed
|
30
|
+
Then the output environment variables include "FOO=BAR"
|
31
|
+
When an existing environment variable with name "FOO" is unset
|
32
|
+
Then the output environment variables do not include "FOO=BAR"
|
33
|
+
|
34
|
+
# Scenario: Create app with environment variable
|
35
|
+
# Scenario: add cartridge with environment variable
|
data/features/lib/rhc_helper.rb
CHANGED
@@ -93,6 +93,8 @@ module RHCHelper
|
|
93
93
|
# in RHCHelper::Sshkey, we pass *args to method_missing here, so that
|
94
94
|
# we _know_ that arg0 is an Array.
|
95
95
|
args << arg0.first if arg0.first
|
96
|
+
when /env/
|
97
|
+
args << arg0.first if arg0.first
|
96
98
|
end
|
97
99
|
|
98
100
|
args.rstrip.gsub(/([\\\$])/, "\\\\\\1")
|
@@ -187,7 +189,7 @@ module RHCHelper
|
|
187
189
|
def domain_create_callback(exitcode, stdout, stderr, arg)
|
188
190
|
@exitcode = exitcode
|
189
191
|
end
|
190
|
-
|
192
|
+
|
191
193
|
def domain_update_callback(exitcode, stdout, stderr, arg)
|
192
194
|
@exitcode = exitcode
|
193
195
|
end
|
@@ -200,7 +202,7 @@ module RHCHelper
|
|
200
202
|
@sshkey_output = stdout
|
201
203
|
@exitcode = exitcode
|
202
204
|
end
|
203
|
-
|
205
|
+
|
204
206
|
def sshkey_add_callback(exitcode, stdout, stderr, arg)
|
205
207
|
@sshkey_output = stdout
|
206
208
|
@exitcode = exitcode
|
@@ -215,7 +217,7 @@ module RHCHelper
|
|
215
217
|
@sshkey_output = stdout
|
216
218
|
@exitcode = exitcode
|
217
219
|
end
|
218
|
-
|
220
|
+
|
219
221
|
def sshkey_update_callback(exitcode, stdout, stderr, arg)
|
220
222
|
@sshkey_output = stdout
|
221
223
|
@exitcode = exitcode
|
@@ -226,4 +228,24 @@ module RHCHelper
|
|
226
228
|
@exitcode = exitcode
|
227
229
|
end
|
228
230
|
|
231
|
+
def env_list_callback(exitcode, stdout, stderr, arg)
|
232
|
+
@env_output = stdout
|
233
|
+
@exitcode = exitcode
|
234
|
+
end
|
235
|
+
|
236
|
+
def env_show_callback(exitcode, stdout, stderr, arg)
|
237
|
+
@env_output = stdout
|
238
|
+
@exitcode = exitcode
|
239
|
+
end
|
240
|
+
|
241
|
+
def env_set_callback(exitcode, stdout, stderr, arg)
|
242
|
+
@env_output = stdout
|
243
|
+
@exitcode = exitcode
|
244
|
+
end
|
245
|
+
|
246
|
+
def env_unset_callback(exitcode, stdout, stderr, arg)
|
247
|
+
@env_output = stdout
|
248
|
+
@exitcode = exitcode
|
249
|
+
end
|
250
|
+
|
229
251
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "rhc/rest"
|
2
|
+
|
3
|
+
module RHCHelper
|
4
|
+
|
5
|
+
class Env
|
6
|
+
extend Runnable
|
7
|
+
extend Commandify
|
8
|
+
|
9
|
+
class << self
|
10
|
+
attr_accessor :env_output, :exitcode
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.list(*args)
|
14
|
+
rhc_env_list args
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.show(*args)
|
18
|
+
rhc_env_show args
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.set(*args)
|
22
|
+
rhc_env_set args
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.unset(*args)
|
26
|
+
rhc_env_unset args
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1 +1,32 @@
|
|
1
1
|
include RHCHelper
|
2
|
+
|
3
|
+
When /^'rhc env (\S+)( .*?)?'(?: command)? is run$/ do |subcommand, rest|
|
4
|
+
if subcommand =~ /^(list|show|set|unset)$/
|
5
|
+
Env.send subcommand.to_sym, rest
|
6
|
+
@env_output = Env.env_output
|
7
|
+
@exitcode = Env.exitcode
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
When /^a new environment variable "(.*?)" is set as "(.*)"$/ do |name, value|
|
12
|
+
pending "no application provided" if @app == nil
|
13
|
+
step "'rhc env set --env #{name}=#{value} --app #{@app.name}' is run"
|
14
|
+
end
|
15
|
+
|
16
|
+
When /^an existing environment variable with name "(.*?)" is unset$/ do |name|
|
17
|
+
pending "no application provided" if @app == nil
|
18
|
+
step "'rhc env unset --env #{name} --app #{@app.name}' is run"
|
19
|
+
end
|
20
|
+
|
21
|
+
Given "the existing environment variables are listed" do
|
22
|
+
pending "no application provided" if @app == nil
|
23
|
+
step "'rhc env list --app #{@app.name}' is run"
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /^the output environment variables (do not )?include "(.*)"$/ do |exclude, str|
|
27
|
+
if exclude
|
28
|
+
@env_output.should_not match(str)
|
29
|
+
else
|
30
|
+
@env_output.should match(str)
|
31
|
+
end
|
32
|
+
end
|
@@ -1,18 +1,8 @@
|
|
1
|
-
if $target_os == 'fedora-
|
2
|
-
CARTRIDGE_MAP = {
|
3
|
-
"php" => { type: "php-5.4", name: "PHP 5.4" },
|
4
|
-
"mysql" => { type: "mysql-5.1", name: "MySQL Database 5.1" },
|
5
|
-
"phpmyadmin" => { type: "phpmyadmin-3", name: "phpMyAdmin 3" },
|
6
|
-
"mongodb" => { type: "mongodb-2.2", name: "MongoDB NoSQL Database 2.2" },
|
7
|
-
"postgresql" => { type: "postgresql-9.2", name: "PostgreSQL Database 9.2" },
|
8
|
-
"cron" => { type: "cron-1.4", name: "Cron 1.4" },
|
9
|
-
"haproxy" => { type: "haproxy-1.4", name: "" }
|
10
|
-
}
|
11
|
-
elsif $target_os == 'fedora-19'
|
1
|
+
if $target_os == 'fedora-19'
|
12
2
|
CARTRIDGE_MAP = {
|
13
3
|
"php" => { type: "php-5.5", name: "PHP 5.5" },
|
14
4
|
"mysql" => { type: "mariadb-5.5", name: "MariaDB 5.5" },
|
15
|
-
"phpmyadmin" => { type: "phpmyadmin-
|
5
|
+
"phpmyadmin" => { type: "phpmyadmin-4", name: "phpMyAdmin 4.0" },
|
16
6
|
"mongodb" => { type: "mongodb-2.2", name: "MongoDB NoSQL Database 2.2" },
|
17
7
|
"postgresql" => { type: "postgresql-9.2", name: "PostgreSQL Database 9.2" },
|
18
8
|
"cron" => { type: "cron-1.4", name: "Cron 1.4" },
|
@@ -22,7 +12,7 @@ else
|
|
22
12
|
CARTRIDGE_MAP = {
|
23
13
|
"php" => { type: "php-5.3", name: "PHP 5.3" },
|
24
14
|
"mysql" => { type: "mysql-5.1", name: "MySQL Database 5.1" },
|
25
|
-
"phpmyadmin" => { type: "phpmyadmin-
|
15
|
+
"phpmyadmin" => { type: "phpmyadmin-4", name: "phpMyAdmin 4.0" },
|
26
16
|
"mongodb" => { type: "mongodb-2.2", name: "MongoDB NoSQL Database 2.2" },
|
27
17
|
"postgresql" => { type: "postgresql-8.4", name: "PostgreSQL Database 8.4" },
|
28
18
|
"cron" => { type: "cron-1.4", name: "Cron 1.4" },
|
@@ -47,9 +47,11 @@ module RHC
|
|
47
47
|
search = search.to_s.downcase.gsub(/[_\-\s]/,' ')
|
48
48
|
[
|
49
49
|
cart.name,
|
50
|
-
cart.description,
|
51
50
|
(cart.tags || []).join(' '),
|
52
|
-
].compact.any?{ |s| s.present? && s.downcase.gsub(/[_\-\s]/,' ').include?(search) }
|
51
|
+
].compact.any?{ |s| s.present? && s.downcase.gsub(/[_\-\s]/,' ').include?(search) } ||
|
52
|
+
search.length > 2 && [
|
53
|
+
cart.description
|
54
|
+
].compact.any?{ |s| s.present? && !s.downcase.match(/\b#{search}\b/).nil? }
|
53
55
|
end
|
54
56
|
|
55
57
|
def web_carts_only
|
data/lib/rhc/commands.rb
CHANGED
@@ -21,11 +21,15 @@ module Commander
|
|
21
21
|
proxy_options.inject Options.new do |options, (option, value)|
|
22
22
|
# options that are present will evaluate to true
|
23
23
|
value = true if value.nil?
|
24
|
+
# if multiple values were specified for this option, collect it as an
|
25
|
+
# array. on 'fill_arguments' we will decide between stick with the array
|
26
|
+
# (if :option_type => :list) or just take the last value from array.
|
27
|
+
# not part of the backported method.
|
24
28
|
if proxy_options.select{ |item| item[0] == option }.length > 1
|
25
29
|
if options[option]
|
26
30
|
options[option] << value
|
27
31
|
else
|
28
|
-
|
32
|
+
options.__send__ :"#{option}=", [value]
|
29
33
|
end
|
30
34
|
else
|
31
35
|
options.__send__ :"#{option}=", value
|
data/lib/rhc/commands/app.rb
CHANGED
@@ -30,13 +30,13 @@ module RHC::Commands
|
|
30
30
|
these cartridges receive no security updates. Note that not
|
31
31
|
all OpenShift servers allow downloaded cartridges.
|
32
32
|
|
33
|
-
When your application is created, a
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
When your application is created, a URL combining the name of
|
34
|
+
your app and the name of your domain will be registered in DNS.
|
35
|
+
A copy of the code for your application will be checked out locally
|
36
|
+
into a folder with the same name as your application. Note that
|
37
|
+
different types of applications may require different folder
|
38
|
+
structures - check the README provided with the cartridge if
|
39
|
+
you have questions.
|
40
40
|
|
41
41
|
OpenShift runs the components of your application on small virtual
|
42
42
|
servers called "gears". Each account or plan is limited to a number
|
@@ -47,7 +47,7 @@ module RHC::Commands
|
|
47
47
|
may be specified to change the gears used.
|
48
48
|
|
49
49
|
DESC
|
50
|
-
syntax "<name> <cartridge> [... <cartridge>] [-n namespace]"
|
50
|
+
syntax "<name> <cartridge> [... <cartridge>] [... VARIABLE=VALUE] [-n namespace]"
|
51
51
|
option ["-n", "--namespace NAME"], "Namespace for the application"
|
52
52
|
option ["-g", "--gear-size SIZE"], "Gear size controls how much memory and CPU your cartridges can use."
|
53
53
|
option ["-s", "--scaling"], "Enable scaling for the web cartridge."
|
@@ -66,6 +66,8 @@ module RHC::Commands
|
|
66
66
|
|
67
67
|
check_name!(name)
|
68
68
|
|
69
|
+
arg_envs, cartridges = cartridges.partition{|item| item.match(env_var_regex_pattern)}
|
70
|
+
|
69
71
|
cartridges = check_cartridges(cartridges, &require_one_web_cart)
|
70
72
|
|
71
73
|
options.default \
|
@@ -82,7 +84,11 @@ module RHC::Commands
|
|
82
84
|
c.usage_rate? ? "#{c.short_name} (addtl. costs may apply)" : c.short_name
|
83
85
|
end.join(', ')
|
84
86
|
|
85
|
-
|
87
|
+
if rest_domain.supports_add_application_with_env_vars?
|
88
|
+
environment_variables = collect_env_vars(arg_envs.concat(Array(options.env)))
|
89
|
+
else
|
90
|
+
warn "Server does not support environment variables."
|
91
|
+
end
|
86
92
|
|
87
93
|
paragraph do
|
88
94
|
header "Application Options"
|
@@ -182,8 +188,7 @@ module RHC::Commands
|
|
182
188
|
['URL:', rest_app.app_url],
|
183
189
|
['SSH to:', rest_app.ssh_string],
|
184
190
|
['Git remote:', rest_app.git_url],
|
185
|
-
(['Cloned to:', repo_dir] if repo_dir)
|
186
|
-
(['Environment variables:', environment_variables.map{|item| "#{item.name}=#{item.value}"}.sort.join(', ')] if environment_variables.present?)
|
191
|
+
(['Cloned to:', repo_dir] if repo_dir)
|
187
192
|
].compact
|
188
193
|
end
|
189
194
|
end
|
@@ -220,7 +225,7 @@ module RHC::Commands
|
|
220
225
|
summary "Start the application"
|
221
226
|
syntax "<app> [--namespace NAME] [--app NAME]"
|
222
227
|
argument :app, "The name of the application you are starting", ["-a", "--app NAME"], :context => :app_context
|
223
|
-
option ["-n", "--namespace NAME"], "
|
228
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
224
229
|
def start(app)
|
225
230
|
app_action app, :start
|
226
231
|
|
@@ -231,7 +236,7 @@ module RHC::Commands
|
|
231
236
|
summary "Stop the application"
|
232
237
|
syntax "<app> [--namespace NAME] [--app NAME]"
|
233
238
|
argument :app, "The name of the application you are stopping", ["-a", "--app NAME"], :context => :app_context
|
234
|
-
option ["-n", "--namespace NAME"], "
|
239
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
235
240
|
def stop(app)
|
236
241
|
app_action app, :stop
|
237
242
|
|
@@ -242,7 +247,7 @@ module RHC::Commands
|
|
242
247
|
summary "Stops all application processes"
|
243
248
|
syntax "<app> [--namespace NAME] [--app NAME]"
|
244
249
|
argument :app, "The name of the application you are stopping", ["-a", "--app NAME"], :context => :app_context
|
245
|
-
option ["-n", "--namespace NAME"], "
|
250
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
246
251
|
def force_stop(app)
|
247
252
|
app_action app, :stop, true
|
248
253
|
|
@@ -253,7 +258,7 @@ module RHC::Commands
|
|
253
258
|
summary "Restart the application"
|
254
259
|
syntax "<app> [--namespace NAME] [--app NAME]"
|
255
260
|
argument :app, "The name of the application you are restarting", ["-a", "--app NAME"], :context => :app_context
|
256
|
-
option ["-n", "--namespace NAME"], "
|
261
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
257
262
|
def restart(app)
|
258
263
|
app_action app, :restart
|
259
264
|
|
@@ -264,7 +269,7 @@ module RHC::Commands
|
|
264
269
|
summary "Reload the application's configuration"
|
265
270
|
syntax "<app> [--namespace NAME] [--app NAME]"
|
266
271
|
argument :app, "The name of the application you are reloading", ["-a", "--app NAME"], :context => :app_context
|
267
|
-
option ["-n", "--namespace NAME"], "
|
272
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
268
273
|
def reload(app)
|
269
274
|
app_action app, :reload
|
270
275
|
|
@@ -305,7 +310,7 @@ module RHC::Commands
|
|
305
310
|
DESC
|
306
311
|
syntax "<app> [--namespace NAME]"
|
307
312
|
argument :app, "The name of the application you are getting information on", ["-a", "--app NAME"], :context => :app_context
|
308
|
-
option ["-n", "--namespace NAME"], "
|
313
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
309
314
|
option ["--state"], "Get the current state of the cartridges in this application"
|
310
315
|
option ["--gears [quota|ssh]"], "Show information about the cartridges on each gear in this application. Pass 'quota' to see per gear disk usage and limits. Pass 'ssh' to print only the SSH connection strings of each gear."
|
311
316
|
def show(app_name)
|
@@ -368,6 +373,9 @@ module RHC::Commands
|
|
368
373
|
include RHC::CartridgeHelpers
|
369
374
|
include RHC::SSHHelpers
|
370
375
|
|
376
|
+
MAX_RETRIES = 7
|
377
|
+
DEFAULT_DELAY_THROTTLE = 2.0
|
378
|
+
|
371
379
|
def require_one_web_cart
|
372
380
|
lambda{ |carts|
|
373
381
|
match, ambiguous = carts.partition{ |c| not c.is_a?(Array) }
|
@@ -69,7 +69,7 @@ module RHC::Commands
|
|
69
69
|
|
70
70
|
summary "Add a cartridge to your application"
|
71
71
|
syntax "<cartridge_type> [--namespace NAME] [--app NAME]"
|
72
|
-
option ["-n", "--namespace NAME"], "
|
72
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
73
73
|
option ["-a", "--app NAME"], "Application you are adding the cartridge to", :context => :app_context, :required => true
|
74
74
|
option ["-e", "--env VARIABLE=VALUE"], "Environment variable(s) to be set on this cartridge, or path to a file containing environment variables", :option_type => :list
|
75
75
|
argument :cart_type, "The type of the cartridge you are adding (run 'rhc cartridge list' to obtain a list of available cartridges)", ["-c", "--cartridge cart_type"]
|
@@ -83,7 +83,8 @@ module RHC::Commands
|
|
83
83
|
|
84
84
|
rest_app = rest_client.find_application(options.namespace, options.app, :include => :cartridges)
|
85
85
|
|
86
|
-
|
86
|
+
supports_env_vars = rest_app.supports_add_cartridge_with_env_vars?
|
87
|
+
cart.environment_variables = collect_env_vars(options.env).map { |item| item.to_hash } if options.env && supports_env_vars
|
87
88
|
|
88
89
|
rest_cartridge = rest_app.add_cartridge(cart)
|
89
90
|
|
@@ -92,7 +93,8 @@ module RHC::Commands
|
|
92
93
|
rest_cartridge.environment_variables = cart.environment_variables if cart.environment_variables.present?
|
93
94
|
|
94
95
|
paragraph{ display_cart(rest_cartridge) }
|
95
|
-
paragraph{ say "Use 'rhc env --help' to manage environment variable(s) on this cartridge and application." }
|
96
|
+
paragraph{ say "Use 'rhc env --help' to manage environment variable(s) on this cartridge and application." } if cart.environment_variables.present?
|
97
|
+
paragraph{ warn "Server does not support environment variables." if options.env && !supports_env_vars }
|
96
98
|
paragraph{ rest_cartridge.messages.each { |msg| success msg } }
|
97
99
|
|
98
100
|
0
|
@@ -100,8 +102,8 @@ module RHC::Commands
|
|
100
102
|
|
101
103
|
summary "Show useful information about a cartridge"
|
102
104
|
syntax "<cartridge> [--namespace NAME] [--app NAME]"
|
103
|
-
option ["-n", "--namespace NAME"], "
|
104
|
-
option ["-a", "--app NAME"], "Application
|
105
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
106
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
105
107
|
argument :cartridge, "The name of the cartridge", ["-c", "--cartridge cart_type"]
|
106
108
|
def show(cartridge)
|
107
109
|
rest_app = rest_client.find_application(options.namespace, options.app, :include => :cartridges)
|
@@ -115,8 +117,8 @@ module RHC::Commands
|
|
115
117
|
summary "Remove a cartridge from your application"
|
116
118
|
syntax "<cartridge> [--namespace NAME] [--app NAME]"
|
117
119
|
argument :cartridge, "The name of the cartridge you are removing", ["-c", "--cartridge cartridge"]
|
118
|
-
option ["-n", "--namespace NAME"], "
|
119
|
-
option ["-a", "--app NAME"], "Application
|
120
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
121
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
120
122
|
option ["--confirm"], "Pass to confirm removing the cartridge"
|
121
123
|
alias_action :"app cartridge remove", :root_command => true, :deprecated => true
|
122
124
|
def remove(cartridge)
|
@@ -137,8 +139,8 @@ module RHC::Commands
|
|
137
139
|
summary "Start a cartridge"
|
138
140
|
syntax "<cartridge> [--namespace NAME] [--app NAME]"
|
139
141
|
argument :cart_type, "The name of the cartridge you are stopping", ["-c", "--cartridge cartridge"]
|
140
|
-
option ["-n", "--namespace NAME"], "
|
141
|
-
option ["-a", "--app NAME"], "Application
|
142
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
143
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
142
144
|
alias_action :"app cartridge start", :root_command => true, :deprecated => true
|
143
145
|
def start(cartridge)
|
144
146
|
cartridge_action(cartridge, :start, 'Starting %s ... ')
|
@@ -148,8 +150,8 @@ module RHC::Commands
|
|
148
150
|
summary "Stop a cartridge"
|
149
151
|
syntax "<cartridge> [--namespace NAME] [--app NAME]"
|
150
152
|
argument :cart_type, "The name of the cartridge you are stopping", ["-c", "--cartridge cartridge"]
|
151
|
-
option ["-n", "--namespace NAME"], "
|
152
|
-
option ["-a", "--app NAME"], "Application
|
153
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
154
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
153
155
|
alias_action :"app cartridge stop", :root_command => true, :deprecated => true
|
154
156
|
def stop(cartridge)
|
155
157
|
cartridge_action(cartridge, :stop, 'Stopping %s ... ')
|
@@ -159,8 +161,8 @@ module RHC::Commands
|
|
159
161
|
summary "Restart a cartridge"
|
160
162
|
syntax "<cartridge_type> [--namespace NAME] [--app NAME]"
|
161
163
|
argument :cart_type, "The name of the cartridge you are restarting", ["-c", "--cartridge cartridge"]
|
162
|
-
option ["-n", "--namespace NAME"], "
|
163
|
-
option ["-a", "--app NAME"], "Application
|
164
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
165
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
164
166
|
alias_action :"app cartridge restart", :root_command => true, :deprecated => true
|
165
167
|
def restart(cartridge)
|
166
168
|
cartridge_action(cartridge, :restart, 'Restarting %s ... ')
|
@@ -170,8 +172,8 @@ module RHC::Commands
|
|
170
172
|
summary "Get current the status of a cartridge"
|
171
173
|
syntax "<cartridge> [--namespace NAME] [--app NAME]"
|
172
174
|
argument :cart_type, "The name of the cartridge you are getting the status of", ["-c", "--cartridge cartridge"]
|
173
|
-
option ["-n", "--namespace NAME"], "
|
174
|
-
option ["-a", "--app NAME"], "Application
|
175
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
176
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
175
177
|
alias_action :"app cartridge status", :root_command => true, :deprecated => true
|
176
178
|
def status(cartridge)
|
177
179
|
rest_app = rest_client.find_application(options.namespace, options.app, :include => :cartridges)
|
@@ -183,8 +185,8 @@ module RHC::Commands
|
|
183
185
|
summary "Reload the cartridge's configuration"
|
184
186
|
syntax "<cartridge> [--namespace NAME] [--app NAME]"
|
185
187
|
argument :cart_type, "The name of the cartridge you are reloading", ["-c", "--cartridge cartridge"]
|
186
|
-
option ["-n", "--namespace NAME"], "
|
187
|
-
option ["-a", "--app NAME"], "Application
|
188
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
189
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
188
190
|
alias_action :"app cartridge reload", :root_command => true, :deprecated => true
|
189
191
|
def reload(cartridge)
|
190
192
|
cartridge_action(cartridge, :reload, 'Reloading %s ... ')
|
@@ -208,8 +210,8 @@ module RHC::Commands
|
|
208
210
|
syntax "<cartridge> [multiplier] [--namespace NAME] [--app NAME] [--min min] [--max max]"
|
209
211
|
argument :cartridge, "The name of the cartridge you are scaling", ["-c", "--cartridge cartridge"]
|
210
212
|
argument :multiplier, "The number of instances of this cartridge you need", [], :optional => true, :hide => true
|
211
|
-
option ["-n", "--namespace NAME"], "
|
212
|
-
option ["-a", "--app NAME"], "Application
|
213
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
214
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
213
215
|
option ["--min min", Integer], "Minimum scaling value"
|
214
216
|
option ["--max max", Integer], "Maximum scaling value"
|
215
217
|
def scale(cartridge, multiplier)
|
@@ -243,8 +245,8 @@ module RHC::Commands
|
|
243
245
|
summary 'View/manipulate storage on a cartridge'
|
244
246
|
syntax '<cartridge> -a app [--show] [--add|--remove|--set amount] [--namespace NAME]'
|
245
247
|
argument :cart_type, "The name of the cartridge", ["-c", "--cartridge cart_type"], :arg_type => :list
|
246
|
-
option ["-n", "--namespace NAME"], "
|
247
|
-
option ["-a", "--app NAME"], "Application
|
248
|
+
option ["-n", "--namespace NAME"], "Application's domain name", :context => :namespace_context, :required => true
|
249
|
+
option ["-a", "--app NAME"], "Application name", :context => :app_context, :required => true
|
248
250
|
option ["--show"], "Show the current base and additional storage capacity"
|
249
251
|
option ["--add amount"], "Add the indicated amount to the additional storage capacity"
|
250
252
|
option ["--remove amount"], "Remove the indicated amount from the additional storage capacity"
|