morpheus-cli 3.6.9 → 3.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/morpheus/api/api_client.rb +0 -4
- data/lib/morpheus/api/deploy_interface.rb +12 -8
- data/lib/morpheus/cli.rb +0 -1
- data/lib/morpheus/cli/access_token_command.rb +3 -4
- data/lib/morpheus/cli/account_groups_command.rb +8 -3
- data/lib/morpheus/cli/apps.rb +10 -5
- data/lib/morpheus/cli/archives_command.rb +20 -6
- data/lib/morpheus/cli/boot_scripts_command.rb +5 -2
- data/lib/morpheus/cli/change_password_command.rb +1 -1
- data/lib/morpheus/cli/cli_command.rb +2 -4
- data/lib/morpheus/cli/cloud_datastores_command.rb +3 -2
- data/lib/morpheus/cli/commands/standard/alias_command.rb +10 -14
- data/lib/morpheus/cli/commands/standard/history_command.rb +0 -20
- data/lib/morpheus/cli/commands/standard/man_command.rb +8 -8
- data/lib/morpheus/cli/containers_command.rb +9 -1
- data/lib/morpheus/cli/credentials.rb +2 -1
- data/lib/morpheus/cli/cypher_command.rb +10 -2
- data/lib/morpheus/cli/dashboard_command.rb +1 -0
- data/lib/morpheus/cli/deployments.rb +5 -1
- data/lib/morpheus/cli/deploys.rb +26 -9
- data/lib/morpheus/cli/execute_schedules_command.rb +9 -1
- data/lib/morpheus/cli/execution_request_command.rb +3 -2
- data/lib/morpheus/cli/file_copy_request_command.rb +3 -2
- data/lib/morpheus/cli/hosts.rb +8 -6
- data/lib/morpheus/cli/image_builder_command.rb +14 -10
- data/lib/morpheus/cli/instance_types.rb +2 -1
- data/lib/morpheus/cli/instances.rb +9 -4
- data/lib/morpheus/cli/key_pairs.rb +33 -21
- data/lib/morpheus/cli/library_container_scripts_command.rb +5 -2
- data/lib/morpheus/cli/library_container_templates_command.rb +5 -2
- data/lib/morpheus/cli/library_container_types_command.rb +5 -3
- data/lib/morpheus/cli/library_instance_types_command.rb +6 -2
- data/lib/morpheus/cli/library_layouts_command.rb +5 -3
- data/lib/morpheus/cli/library_option_lists_command.rb +5 -1
- data/lib/morpheus/cli/library_option_types_command.rb +5 -0
- data/lib/morpheus/cli/library_upgrades_command.rb +5 -3
- data/lib/morpheus/cli/license.rb +3 -0
- data/lib/morpheus/cli/load_balancers.rb +10 -1
- data/lib/morpheus/cli/mixins/processes_helper.rb +10 -4
- data/lib/morpheus/cli/monitoring_apps_command.rb +32 -26
- data/lib/morpheus/cli/monitoring_checks_command.rb +35 -27
- data/lib/morpheus/cli/monitoring_contacts_command.rb +19 -16
- data/lib/morpheus/cli/monitoring_groups_command.rb +32 -26
- data/lib/morpheus/cli/monitoring_incidents_command.rb +39 -30
- data/lib/morpheus/cli/network_domains_command.rb +5 -2
- data/lib/morpheus/cli/network_groups_command.rb +5 -2
- data/lib/morpheus/cli/network_pool_servers_command.rb +5 -2
- data/lib/morpheus/cli/network_pools_command.rb +5 -2
- data/lib/morpheus/cli/network_proxies_command.rb +5 -2
- data/lib/morpheus/cli/network_services_command.rb +1 -0
- data/lib/morpheus/cli/networks_command.rb +5 -2
- data/lib/morpheus/cli/packages_command.rb +6 -3
- data/lib/morpheus/cli/policies_command.rb +17 -3
- data/lib/morpheus/cli/power_schedules_command.rb +9 -1
- data/lib/morpheus/cli/preseed_scripts_command.rb +5 -2
- data/lib/morpheus/cli/processes_command.rb +17 -6
- data/lib/morpheus/cli/recent_activity_command.rb +1 -0
- data/lib/morpheus/cli/remote.rb +1 -0
- data/lib/morpheus/cli/roles.rb +14 -5
- data/lib/morpheus/cli/security_group_rules.rb +8 -4
- data/lib/morpheus/cli/security_groups.rb +4 -0
- data/lib/morpheus/cli/shell.rb +13 -23
- data/lib/morpheus/cli/storage_providers_command.rb +12 -6
- data/lib/morpheus/cli/tasks.rb +6 -0
- data/lib/morpheus/cli/tenants_command.rb +13 -9
- data/lib/morpheus/cli/user_groups_command.rb +7 -1
- data/lib/morpheus/cli/user_settings_command.rb +7 -1
- data/lib/morpheus/cli/user_sources_command.rb +10 -8
- data/lib/morpheus/cli/users.rb +7 -2
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/virtual_images.rb +8 -1
- data/lib/morpheus/cli/whoami.rb +34 -15
- data/lib/morpheus/cli/workflows.rb +5 -0
- data/lib/morpheus/formatters.rb +4 -0
- data/lib/morpheus/rest_client.rb +6 -1
- metadata +2 -4
- data/lib/morpheus/api/app_templates_interface.rb +0 -64
- data/lib/morpheus/cli/app_templates.rb +0 -2019
@@ -14,21 +14,6 @@ class Morpheus::Cli::HistoryCommand
|
|
14
14
|
options = {}
|
15
15
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
16
16
|
opts.banner = "Usage: morpheus #{command_name}"
|
17
|
-
# opts.on( '-m', '--max MAX', "Max Results" ) do |max|
|
18
|
-
# options[:max] = max.to_i
|
19
|
-
# end
|
20
|
-
# opts.on( '-o', '--offset OFFSET', "Offset Results" ) do |offset|
|
21
|
-
# options[:offset] = offset.to_i.abs
|
22
|
-
# end
|
23
|
-
# opts.on( '-s', '--search PHRASE', "Search Phrase" ) do |phrase|
|
24
|
-
# options[:phrase] = phrase
|
25
|
-
# end
|
26
|
-
# opts.on( '-S', '--sort ORDER', "Sort Order" ) do |v|
|
27
|
-
# options[:sort] = v
|
28
|
-
# end
|
29
|
-
# opts.on( '-D', '--desc', "Reverse Sort Order" ) do |v|
|
30
|
-
# options[:direction] = "desc"
|
31
|
-
# end
|
32
17
|
opts.on( '-n', '--max-commands MAX', "Max Results. Default is 25" ) do |val|
|
33
18
|
options[:max] = val
|
34
19
|
end
|
@@ -64,11 +49,6 @@ EOT
|
|
64
49
|
else
|
65
50
|
max_commands = options[:max] || 25
|
66
51
|
Morpheus::Cli::Shell.instance.print_history(max_commands)
|
67
|
-
last_cmd = Morpheus::Cli::Shell.instance.last_command
|
68
|
-
# log history, but not consecutive log entries
|
69
|
-
if last_cmd.nil? || last_cmd[:command] != raw_cmd
|
70
|
-
Morpheus::Cli::Shell.instance.log_history_command(raw_cmd)
|
71
|
-
end
|
72
52
|
return 0
|
73
53
|
end
|
74
54
|
end
|
@@ -66,15 +66,15 @@ EOT
|
|
66
66
|
|
67
67
|
fn = Morpheus::Cli::ManCommand.man_file_path
|
68
68
|
if regenerate || !File.exists?(fn)
|
69
|
-
#Morpheus::Logging::DarkPrinter.puts "generating manual #{fn} ..." if Morpheus::Logging.debug?
|
70
|
-
Morpheus::Cli::ManCommand.generate_manual()
|
69
|
+
#Morpheus::Logging::DarkPrinter.puts "generating manual #{fn} ..." if Morpheus::Logging.debug? && !options[:quiet]
|
70
|
+
Morpheus::Cli::ManCommand.generate_manual(options)
|
71
71
|
end
|
72
72
|
|
73
73
|
if options[:quiet]
|
74
74
|
return 0, nil
|
75
75
|
end
|
76
76
|
|
77
|
-
Morpheus::Logging::DarkPrinter.puts "opening manual file #{fn}" if Morpheus::Logging.debug?
|
77
|
+
Morpheus::Logging::DarkPrinter.puts "opening manual file #{fn}" if Morpheus::Logging.debug? && !options[:quiet]
|
78
78
|
|
79
79
|
|
80
80
|
if open_as_link # not used atm
|
@@ -134,14 +134,14 @@ EOT
|
|
134
134
|
# FileUtils.chmod(0600, fn)
|
135
135
|
# end
|
136
136
|
|
137
|
-
def self.generate_manual()
|
137
|
+
def self.generate_manual(options={})
|
138
138
|
# todo: use pandoc or something else to convert the CLI-Manual.md to a man page
|
139
139
|
# and install it, so the os command `man morpheus` will work too.
|
140
140
|
fn = man_file_path()
|
141
141
|
if !Dir.exists?(File.dirname(fn))
|
142
142
|
FileUtils.mkdir_p(File.dirname(fn))
|
143
143
|
end
|
144
|
-
Morpheus::Logging::DarkPrinter.puts "generating manual #{fn}" if Morpheus::Logging.debug?
|
144
|
+
Morpheus::Logging::DarkPrinter.puts "generating manual #{fn}" if Morpheus::Logging.debug? && !options[:quiet]
|
145
145
|
|
146
146
|
File.open(fn, 'w') {|f| f.write("") } # clear file
|
147
147
|
FileUtils.chmod(0600, fn)
|
@@ -211,7 +211,7 @@ EOT
|
|
211
211
|
ENDTEXT
|
212
212
|
|
213
213
|
terminal = Morpheus::Terminal.new($stdin, manpage)
|
214
|
-
Morpheus::Logging::DarkPrinter.puts "appending command help `morpheus --help`" if Morpheus::Logging.debug?
|
214
|
+
Morpheus::Logging::DarkPrinter.puts "appending command help `morpheus --help`" if Morpheus::Logging.debug? && !options[:quiet]
|
215
215
|
|
216
216
|
manpage.print "\n"
|
217
217
|
manpage.print "## morpheus\n"
|
@@ -224,7 +224,7 @@ ENDTEXT
|
|
224
224
|
Morpheus::Cli::CliRegistry.all.keys.sort.each do |cmd|
|
225
225
|
cmd_klass = Morpheus::Cli::CliRegistry.instance.get(cmd)
|
226
226
|
cmd_instance = cmd_klass.new
|
227
|
-
Morpheus::Logging::DarkPrinter.puts "appending command help `morpheus #{cmd} --help`" if Morpheus::Logging.debug?
|
227
|
+
Morpheus::Logging::DarkPrinter.puts "appending command help `morpheus #{cmd} --help`" if Morpheus::Logging.debug? && !options[:quiet]
|
228
228
|
#help_cmd = "morpheus #{cmd} --help"
|
229
229
|
#help_output = `#{help_cmd}`
|
230
230
|
manpage.print "\n"
|
@@ -240,7 +240,7 @@ ENDTEXT
|
|
240
240
|
subcommands = cmd_klass.subcommands
|
241
241
|
if subcommands && subcommands.size > 0
|
242
242
|
subcommands.sort.each do |subcommand, subcommand_method|
|
243
|
-
Morpheus::Logging::DarkPrinter.puts "appending command help `morpheus #{cmd} #{subcommand} --help`" if Morpheus::Logging.debug?
|
243
|
+
Morpheus::Logging::DarkPrinter.puts "appending command help `morpheus #{cmd} #{subcommand} --help`" if Morpheus::Logging.debug? && !options[:quiet]
|
244
244
|
manpage.print "\n"
|
245
245
|
manpage.print "#### morpheus #{cmd} #{subcommand}\n"
|
246
246
|
manpage.print "\n"
|
@@ -59,6 +59,7 @@ class Morpheus::Cli::ContainersCommand
|
|
59
59
|
|
60
60
|
def _get(arg, options)
|
61
61
|
begin
|
62
|
+
@containers_interface.setopts(options)
|
62
63
|
if options[:dry_run]
|
63
64
|
print_dry_run @containers_interface.dry.get(arg.to_i)
|
64
65
|
return
|
@@ -179,6 +180,7 @@ class Morpheus::Cli::ContainersCommand
|
|
179
180
|
def _stop(container_id, options)
|
180
181
|
container = find_container_by_id(container_id) # could skip this since only id is supported
|
181
182
|
return 1 if container.nil?
|
183
|
+
@containers_interface.setopts(options)
|
182
184
|
if options[:dry_run]
|
183
185
|
print_dry_run @containers_interface.dry.stop(container['id'])
|
184
186
|
return 0
|
@@ -218,6 +220,7 @@ class Morpheus::Cli::ContainersCommand
|
|
218
220
|
def _start(container_id, options)
|
219
221
|
container = find_container_by_id(container_id) # could skip this since only id is supported
|
220
222
|
return 1 if container.nil?
|
223
|
+
@containers_interface.setopts(options)
|
221
224
|
if options[:dry_run]
|
222
225
|
print_dry_run @containers_interface.dry.start(container['id'])
|
223
226
|
return 0
|
@@ -257,6 +260,7 @@ class Morpheus::Cli::ContainersCommand
|
|
257
260
|
def _restart(container_id, options)
|
258
261
|
container = find_container_by_id(container_id) # could skip this since only id is supported
|
259
262
|
return 1 if container.nil?
|
263
|
+
@containers_interface.setopts(options)
|
260
264
|
if options[:dry_run]
|
261
265
|
print_dry_run @containers_interface.dry.restart(container['id'])
|
262
266
|
return 0
|
@@ -296,6 +300,7 @@ class Morpheus::Cli::ContainersCommand
|
|
296
300
|
def _suspend(container_id, options)
|
297
301
|
container = find_container_by_id(container_id) # could skip this since only id is supported
|
298
302
|
return 1 if container.nil?
|
303
|
+
@containers_interface.setopts(options)
|
299
304
|
if options[:dry_run]
|
300
305
|
print_dry_run @containers_interface.dry.suspend(container['id'])
|
301
306
|
return 0
|
@@ -335,6 +340,7 @@ class Morpheus::Cli::ContainersCommand
|
|
335
340
|
def _eject(container_id, options)
|
336
341
|
container = find_container_by_id(container_id) # could skip this since only id is supported
|
337
342
|
return 1 if container.nil?
|
343
|
+
@containers_interface.setopts(options)
|
338
344
|
if options[:dry_run]
|
339
345
|
print_dry_run @containers_interface.dry.eject(container['id'])
|
340
346
|
return 0
|
@@ -379,6 +385,7 @@ class Morpheus::Cli::ContainersCommand
|
|
379
385
|
container_ids = containers.collect {|container| container["id"] }
|
380
386
|
begin
|
381
387
|
# container = find_container_by_name_or_id(args[0])
|
388
|
+
@containers_interface.setopts(options)
|
382
389
|
if options[:dry_run]
|
383
390
|
print_dry_run @containers_interface.dry.available_actions(container_ids)
|
384
391
|
return 0
|
@@ -479,6 +486,7 @@ class Morpheus::Cli::ContainersCommand
|
|
479
486
|
# return run_command_for_each_arg(containers) do |arg|
|
480
487
|
# _action(arg, action_id, options)
|
481
488
|
# end
|
489
|
+
@containers_interface.setopts(options)
|
482
490
|
if options[:dry_run]
|
483
491
|
print_dry_run @containers_interface.dry.action(container_ids, action_id)
|
484
492
|
return 0
|
@@ -550,7 +558,7 @@ class Morpheus::Cli::ContainersCommand
|
|
550
558
|
end
|
551
559
|
payload['script'] = script_content
|
552
560
|
end
|
553
|
-
|
561
|
+
@execution_request_interface.setopts(options)
|
554
562
|
if options[:dry_run]
|
555
563
|
print_dry_run @execution_request_interface.dry.create(params, payload)
|
556
564
|
return 0
|
@@ -49,13 +49,14 @@ module Morpheus
|
|
49
49
|
# for now, it just stores the access token without other wallet info
|
50
50
|
begin
|
51
51
|
whoami_interface = Morpheus::WhoamiInterface.new(options[:remote_token], nil, nil, @appliance_url)
|
52
|
+
whoami_interface.setopts(options)
|
52
53
|
if options[:dry_run]
|
53
54
|
print_dry_run whoami_interface.dry.get()
|
54
55
|
return nil
|
55
56
|
end
|
56
57
|
whoami_response = whoami_interface.get()
|
57
58
|
if options[:json]
|
58
|
-
|
59
|
+
puts as_json(whoami_response, options)
|
59
60
|
print reset, "\n"
|
60
61
|
end
|
61
62
|
# store mock /oauth/token auth_interface.login() result
|
@@ -381,8 +381,16 @@ class Morpheus::Cli::CypherCommand
|
|
381
381
|
print_dry_run @cypher_interface.dry.create(item_key, payload)
|
382
382
|
return
|
383
383
|
end
|
384
|
-
|
385
|
-
|
384
|
+
existing_cypher = nil
|
385
|
+
json_response = @cypher_interface.list(item_key)
|
386
|
+
puts "json_response: #{json_response}"
|
387
|
+
if json_response["data"] && json_response["data"]["keys"]
|
388
|
+
existing_cypher = json_response["data"]["keys"].find {|k| k == item_key }
|
389
|
+
end
|
390
|
+
if existing_cypher
|
391
|
+
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to overwrite the cypher key #{item_key}?")
|
392
|
+
return 9, "aborted command"
|
393
|
+
end
|
386
394
|
end
|
387
395
|
json_response = @cypher_interface.create(item_key, payload)
|
388
396
|
if options[:json]
|
@@ -35,6 +35,7 @@ class Morpheus::Cli::Deployments
|
|
35
35
|
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
36
36
|
params[k] = options[k] unless options[k].nil?
|
37
37
|
end
|
38
|
+
@deployments_interface.setopts(options)
|
38
39
|
if options[:dry_run]
|
39
40
|
print_dry_run @deployments_interface.dry.get(params)
|
40
41
|
return
|
@@ -82,7 +83,7 @@ class Morpheus::Cli::Deployments
|
|
82
83
|
end
|
83
84
|
deployment = find_deployment_by_name_or_id(deployment_name)
|
84
85
|
exit 1 if deployment.nil?
|
85
|
-
|
86
|
+
@deployments_interface.setopts(options)
|
86
87
|
if options[:dry_run]
|
87
88
|
print_dry_run @deployments_interface.dry.list_versions(deployment['id'],params)
|
88
89
|
return
|
@@ -148,6 +149,7 @@ class Morpheus::Cli::Deployments
|
|
148
149
|
|
149
150
|
|
150
151
|
payload = {deployment: deployment_payload}
|
152
|
+
@deployments_interface.setopts(options)
|
151
153
|
if options[:dry_run]
|
152
154
|
print_dry_run @deployments_interface.dry.update(deployment['id'], payload)
|
153
155
|
return
|
@@ -185,6 +187,7 @@ class Morpheus::Cli::Deployments
|
|
185
187
|
connect(options)
|
186
188
|
begin
|
187
189
|
payload = {deployment: {name: deployment_name, description: options[:description]}}
|
190
|
+
@deployments_interface.setopts(options)
|
188
191
|
if options[:dry_run]
|
189
192
|
print_dry_run @deployments_interface.dry.create(payload)
|
190
193
|
return
|
@@ -220,6 +223,7 @@ class Morpheus::Cli::Deployments
|
|
220
223
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the deployment #{deployment['name']}?")
|
221
224
|
exit
|
222
225
|
end
|
226
|
+
@deployments_interface.setopts(options)
|
223
227
|
if options[:dry_run]
|
224
228
|
print_dry_run @deployments_interface.dry.destroy(deployment['id'])
|
225
229
|
return
|
data/lib/morpheus/cli/deploys.rb
CHANGED
@@ -29,7 +29,7 @@ class Morpheus::Cli::Deploys
|
|
29
29
|
options={}
|
30
30
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
31
31
|
opts.banner = "Usage: morpheus deploy [environment]"
|
32
|
-
build_common_options(opts, options, [])
|
32
|
+
build_common_options(opts, options, [:remote, :dry_run])
|
33
33
|
opts.footer = "Deploy to an environment using the morpheus.yml file, located in the working directory."
|
34
34
|
# "todo: document me better!"
|
35
35
|
end
|
@@ -66,6 +66,11 @@ class Morpheus::Cli::Deploys
|
|
66
66
|
return
|
67
67
|
end
|
68
68
|
end
|
69
|
+
@deploy_interface.setopts(options)
|
70
|
+
@instances_interface.setopts(options)
|
71
|
+
if options[:dry_run]
|
72
|
+
print_dry_run @deploy_interface.create(instance_id)
|
73
|
+
end
|
69
74
|
# Create a new deployment record
|
70
75
|
deploy_result = @deploy_interface.create(instance_id)
|
71
76
|
app_deploy = deploy_result['appDeploy']
|
@@ -81,7 +86,11 @@ class Morpheus::Cli::Deploys
|
|
81
86
|
if File.file?(file)
|
82
87
|
print cyan,bold, " - Uploading #{file} ...", reset, "\n"
|
83
88
|
destination = file.split("/")[0..-2].join("/")
|
84
|
-
|
89
|
+
if options[:dry_run]
|
90
|
+
print_dry_run @deploy_interface.upload_file(deployment_id,file,destination)
|
91
|
+
else
|
92
|
+
upload_result = @deploy_interface.upload_file(deployment_id,file,destination)
|
93
|
+
end
|
85
94
|
end
|
86
95
|
end
|
87
96
|
end
|
@@ -103,8 +112,13 @@ class Morpheus::Cli::Deploys
|
|
103
112
|
evars << {name: key, value: value, export: false}
|
104
113
|
end
|
105
114
|
payload = {envs: evars}
|
106
|
-
|
107
|
-
|
115
|
+
if options[:dry_run]
|
116
|
+
print_dry_run @instances_interface.create_env(instance_id, payload)
|
117
|
+
print_dry_run @instances_interface.restart(instance_id)
|
118
|
+
else
|
119
|
+
@instances_interface.create_env(instance_id, payload)
|
120
|
+
@instances_interface.restart(instance_id)
|
121
|
+
end
|
108
122
|
end
|
109
123
|
if deploy_args['options']
|
110
124
|
deploy_payload = {
|
@@ -113,12 +127,15 @@ class Morpheus::Cli::Deploys
|
|
113
127
|
}
|
114
128
|
}
|
115
129
|
end
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
130
|
+
if options[:dry_run]
|
131
|
+
print_dry_run @deploy_interface.deploy(deployment_id,deploy_payload)
|
132
|
+
else
|
133
|
+
print cyan, bold, "Deploying to Servers...", reset, "\n"
|
134
|
+
@deploy_interface.deploy(deployment_id,deploy_payload)
|
135
|
+
print cyan, bold, "Deploy Successful!", reset, "\n"
|
136
|
+
end
|
137
|
+
|
120
138
|
end
|
121
|
-
|
122
139
|
def list(args)
|
123
140
|
end
|
124
141
|
|
@@ -33,6 +33,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
33
33
|
connect(options)
|
34
34
|
begin
|
35
35
|
params.merge!(parse_list_options(options))
|
36
|
+
@execute_schedules_interface.setopts(options)
|
36
37
|
if options[:dry_run]
|
37
38
|
print_dry_run @execute_schedules_interface.dry.list(params)
|
38
39
|
return
|
@@ -102,6 +103,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
102
103
|
if schedule.nil?
|
103
104
|
return 1
|
104
105
|
end
|
106
|
+
@execute_schedules_interface.setopts(options)
|
105
107
|
if options[:dry_run]
|
106
108
|
print_dry_run @execute_schedules_interface.dry.get(schedule['id'])
|
107
109
|
return
|
@@ -218,6 +220,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
218
220
|
# todo: prompt?
|
219
221
|
payload = {'schedule' => params}
|
220
222
|
end
|
223
|
+
@execute_schedules_interface.setopts(options)
|
221
224
|
if options[:dry_run]
|
222
225
|
print_dry_run @execute_schedules_interface.dry.create(payload)
|
223
226
|
return
|
@@ -289,6 +292,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
289
292
|
params.deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) }) if options[:options]
|
290
293
|
payload = {'schedule' => params}
|
291
294
|
end
|
295
|
+
@execute_schedules_interface.setopts(options)
|
292
296
|
if options[:dry_run]
|
293
297
|
print_dry_run @execute_schedules_interface.dry.update(schedule["id"], payload)
|
294
298
|
return
|
@@ -336,7 +340,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
336
340
|
# }
|
337
341
|
# payload['schedule'].merge!(schedule)
|
338
342
|
payload = params
|
339
|
-
|
343
|
+
@execute_schedules_interface.setopts(options)
|
340
344
|
if options[:dry_run]
|
341
345
|
print_dry_run @execute_schedules_interface.dry.destroy(schedule["id"])
|
342
346
|
return
|
@@ -391,6 +395,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
391
395
|
end
|
392
396
|
payload = {'instances' => instances.collect {|it| it['id'] } }
|
393
397
|
end
|
398
|
+
@execute_schedules_interface.setopts(options)
|
394
399
|
if options[:dry_run]
|
395
400
|
print_dry_run @execute_schedules_interface.dry.add_instances(schedule["id"], payload)
|
396
401
|
return 0
|
@@ -449,6 +454,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
449
454
|
end
|
450
455
|
payload = {'instances' => instances.collect {|it| it['id'] } }
|
451
456
|
end
|
457
|
+
@execute_schedules_interface.setopts(options)
|
452
458
|
if options[:dry_run]
|
453
459
|
print_dry_run @execute_schedules_interface.dry.remove_instances(schedule["id"], payload)
|
454
460
|
return 0
|
@@ -507,6 +513,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
507
513
|
end
|
508
514
|
payload = {'servers' => servers.collect {|it| it['id'] } }
|
509
515
|
end
|
516
|
+
@execute_schedules_interface.setopts(options)
|
510
517
|
if options[:dry_run]
|
511
518
|
print_dry_run @execute_schedules_interface.dry.add_servers(schedule["id"], payload)
|
512
519
|
return 0
|
@@ -565,6 +572,7 @@ class Morpheus::Cli::ExecuteSchedulesCommand
|
|
565
572
|
end
|
566
573
|
payload = {'servers' => servers.collect {|it| it['id'] } }
|
567
574
|
end
|
575
|
+
@execute_schedules_interface.setopts(options)
|
568
576
|
if options[:dry_run]
|
569
577
|
print_dry_run @execute_schedules_interface.dry.remove_servers(schedule["id"], payload)
|
570
578
|
return 0
|
@@ -56,6 +56,7 @@ class Morpheus::Cli::ExecutionRequestCommand
|
|
56
56
|
execution_request_id = args[0]
|
57
57
|
begin
|
58
58
|
params.merge!(parse_list_options(options))
|
59
|
+
@execution_request_interface.setopts(options)
|
59
60
|
if options[:dry_run]
|
60
61
|
print_dry_run @execution_request_interface.dry.get(execution_request_id, params)
|
61
62
|
return
|
@@ -194,7 +195,7 @@ class Morpheus::Cli::ExecutionRequestCommand
|
|
194
195
|
end
|
195
196
|
payload['script'] = script_content
|
196
197
|
end
|
197
|
-
|
198
|
+
@execution_request_interface.setopts(options)
|
198
199
|
if options[:dry_run]
|
199
200
|
print_dry_run @execution_request_interface.dry.create(params, payload)
|
200
201
|
return 0
|
@@ -269,7 +270,7 @@ class Morpheus::Cli::ExecutionRequestCommand
|
|
269
270
|
payload['script'] = script_content
|
270
271
|
end
|
271
272
|
end
|
272
|
-
|
273
|
+
@execution_request_interface.setopts(options)
|
273
274
|
if options[:dry_run]
|
274
275
|
print_dry_run @execution_request_interface.dry.execute_against_lease(execution_request_id, params, payload)
|
275
276
|
return 0
|
@@ -56,6 +56,7 @@ class Morpheus::Cli::FileCopyRequestCommand
|
|
56
56
|
file_copy_request_id = args[0]
|
57
57
|
begin
|
58
58
|
params.merge!(parse_list_options(options))
|
59
|
+
@file_copy_request_interface.setopts(options)
|
59
60
|
if options[:dry_run]
|
60
61
|
print_dry_run @file_copy_request_interface.dry.get(file_copy_request_id, params)
|
61
62
|
return
|
@@ -203,7 +204,7 @@ class Morpheus::Cli::FileCopyRequestCommand
|
|
203
204
|
params['targetPath'] = v_prompt['targetPath']
|
204
205
|
end
|
205
206
|
|
206
|
-
|
207
|
+
@file_copy_request_interface.setopts(options)
|
207
208
|
if options[:dry_run]
|
208
209
|
print_dry_run @file_copy_request_interface.dry.create(local_file, params)
|
209
210
|
return 0
|
@@ -297,7 +298,7 @@ class Morpheus::Cli::FileCopyRequestCommand
|
|
297
298
|
begin
|
298
299
|
# construct payload
|
299
300
|
|
300
|
-
|
301
|
+
@file_copy_request_interface.setopts(options)
|
301
302
|
if options[:dry_run]
|
302
303
|
print_dry_run @file_copy_request_interface.dry.download_file_chunked(file_copy_request_id, outfile, params)
|
303
304
|
return 0
|
data/lib/morpheus/cli/hosts.rb
CHANGED
@@ -293,16 +293,17 @@ class Morpheus::Cli::Hosts
|
|
293
293
|
|
294
294
|
def _get(arg, options)
|
295
295
|
begin
|
296
|
+
@servers_interface.setopts(options)
|
296
297
|
if options[:dry_run]
|
297
298
|
if arg.to_s =~ /\A\d{1,}\Z/
|
298
|
-
print_dry_run @servers_interface.
|
299
|
+
print_dry_run @servers_interface.dry.get(arg.to_i)
|
299
300
|
else
|
300
|
-
print_dry_run @servers_interface.
|
301
|
+
print_dry_run @servers_interface.dry.list({name: arg})
|
301
302
|
end
|
302
303
|
return
|
303
304
|
end
|
304
305
|
server = find_host_by_name_or_id(arg)
|
305
|
-
json_response = @servers_interface.
|
306
|
+
json_response = @servers_interface.get(server['id'])
|
306
307
|
if options[:json]
|
307
308
|
json_response.delete('stats') if options[:include_fields]
|
308
309
|
puts as_json(json_response, options, "server")
|
@@ -384,16 +385,17 @@ class Morpheus::Cli::Hosts
|
|
384
385
|
|
385
386
|
def _stats(arg, options)
|
386
387
|
begin
|
388
|
+
@servers_interface.setopts(options)
|
387
389
|
if options[:dry_run]
|
388
390
|
if arg.to_s =~ /\A\d{1,}\Z/
|
389
|
-
print_dry_run @servers_interface.
|
391
|
+
print_dry_run @servers_interface.dry.get(arg.to_i)
|
390
392
|
else
|
391
|
-
print_dry_run @servers_interface.
|
393
|
+
print_dry_run @servers_interface.dry.list({name: arg})
|
392
394
|
end
|
393
395
|
return
|
394
396
|
end
|
395
397
|
server = find_host_by_name_or_id(arg)
|
396
|
-
json_response = @servers_interface.
|
398
|
+
json_response = @servers_interface.get(server['id'])
|
397
399
|
if options[:json]
|
398
400
|
puts as_json(json_response, options, "stats")
|
399
401
|
return 0
|