morpheus-cli 3.6.9 → 3.6.11
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.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3d463857d867530a0377c41c1dc74f7ef7a70263e98d24b9a161a245c602fb6
|
4
|
+
data.tar.gz: b54e2067737379a676e48feefe1c347a7a5bbb1df4694651b2e55195e4c91f3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b23d4bcb6342da85c55c27b641a13bb6277071beb9e925774317d61c96db96d1fdabbf36ab2f344bf82dbc6cb9dabd477354a42b1e9e7c2cfb576953e5a3c891
|
7
|
+
data.tar.gz: fa239481d1a0498b45aaeb1db54a34620891ea308b2a386cec31483b5345bafb2b7f3b0bd34c05bbda678644c6d61c6c4b0fdbe8cdd81061adbd60fbca4be969
|
@@ -260,10 +260,6 @@ class Morpheus::APIClient
|
|
260
260
|
Morpheus::BlueprintsInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
261
261
|
end
|
262
262
|
|
263
|
-
def app_templates
|
264
|
-
Morpheus::AppTemplatesInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
265
|
-
end
|
266
|
-
|
267
263
|
def deploy
|
268
264
|
Morpheus::DeployInterface.new(@access_token, @refresh_token, @expires_at, @base_url).setopts(@options)
|
269
265
|
end
|
@@ -40,20 +40,24 @@ class Morpheus::DeployInterface < Morpheus::APIClient
|
|
40
40
|
|
41
41
|
# todo: use execute() to support @dry_run?
|
42
42
|
def upload_file(id,path,destination=nil)
|
43
|
-
|
43
|
+
url = "#{@base_url}/api/deploy/#{id}/files"
|
44
44
|
if !destination.empty?
|
45
|
-
|
45
|
+
url += "/#{destination}"
|
46
46
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/octet-stream' }
|
48
|
+
opts = { method: :post, url: url, headers: headers, payload: File.new(path,'rb')}
|
49
|
+
if @dry_run
|
50
|
+
return opts
|
51
|
+
end
|
52
|
+
uri = URI.parse(url)
|
53
|
+
req = Net::HTTP::Post::Multipart.new uri.path,
|
50
54
|
"file" => UploadIO.new(File.new(path,'rb'), "image/jpeg", File.basename(path))
|
51
|
-
|
55
|
+
# todo: iterate headers and abstract th :upload_io to execute() too.
|
52
56
|
req['Authorization'] = "Bearer #{@access_token}"
|
53
|
-
res = Net::HTTP.start(
|
57
|
+
res = Net::HTTP.start(uri.host, uri.port) do |http|
|
54
58
|
http.request(req)
|
55
59
|
end
|
56
|
-
|
60
|
+
res
|
57
61
|
end
|
58
62
|
|
59
63
|
def destroy(id)
|
data/lib/morpheus/cli.rb
CHANGED
@@ -91,7 +91,6 @@ module Morpheus
|
|
91
91
|
load 'morpheus/cli/containers_command.rb'
|
92
92
|
load 'morpheus/cli/apps.rb'
|
93
93
|
load 'morpheus/cli/blueprints_command.rb'
|
94
|
-
load 'morpheus/cli/app_templates.rb' # deprecated
|
95
94
|
load 'morpheus/cli/deploys.rb'
|
96
95
|
load 'morpheus/cli/license.rb'
|
97
96
|
load 'morpheus/cli/instance_types.rb'
|
@@ -42,7 +42,8 @@ class Morpheus::Cli::AccessTokenCommand
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def handle(args)
|
45
|
-
|
45
|
+
# access-token get by default, except access-token -h should list the subcommands.
|
46
|
+
if args.empty? || (args[0] && args[0] =~ /^\-/ && !['-h', '--help'].include?(args[0]))
|
46
47
|
print_access_token(args)
|
47
48
|
else
|
48
49
|
handle_subcommand(args)
|
@@ -124,10 +125,8 @@ class Morpheus::Cli::AccessTokenCommand
|
|
124
125
|
end
|
125
126
|
|
126
127
|
connect(options)
|
127
|
-
|
128
128
|
if options[:dry_run]
|
129
|
-
|
130
|
-
print_dry_run auth_interface.dry.use_refresh_token(@wallet['refresh_token'])
|
129
|
+
print_dry_run Morpheus::AuthInterface.new(@appliance_url).setopts(options).use_refresh_token(@wallet['refresh_token'])
|
131
130
|
return 0
|
132
131
|
end
|
133
132
|
unless options[:quiet]
|
@@ -61,7 +61,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
61
61
|
account_id = account['id']
|
62
62
|
|
63
63
|
params.merge!(parse_list_options(options))
|
64
|
-
|
64
|
+
@account_groups_interface.setopts(options)
|
65
65
|
if options[:dry_run]
|
66
66
|
print_dry_run @account_groups_interface.dry.list(account['id'], params)
|
67
67
|
return
|
@@ -119,6 +119,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
119
119
|
account_id = account['id']
|
120
120
|
|
121
121
|
if options[:dry_run]
|
122
|
+
@account_groups_interface.setopts(options)
|
122
123
|
if args[0].to_s =~ /\A\d{1,}\Z/
|
123
124
|
print_dry_run @account_groups_interface.dry.get(account_id, args[0].to_i)
|
124
125
|
else
|
@@ -128,6 +129,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
128
129
|
end
|
129
130
|
|
130
131
|
group = find_account_group_by_name_or_id(account_id, args[0])
|
132
|
+
@account_groups_interface.setopts(options)
|
131
133
|
return 1 if group.nil?
|
132
134
|
# skip redundant request
|
133
135
|
# json_response = @account_groups_interface.dry.get(account_id, args[0].to_i)
|
@@ -215,7 +217,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
215
217
|
params = Morpheus::Cli::OptionTypes.prompt(all_option_types, options[:options], @api_client, {})
|
216
218
|
group_payload.merge!(params)
|
217
219
|
payload = {group: group_payload}
|
218
|
-
|
220
|
+
@account_groups_interface.setopts(options)
|
219
221
|
if options[:dry_run]
|
220
222
|
print_dry_run @account_groups_interface.dry.create(account['id'], payload)
|
221
223
|
return
|
@@ -279,7 +281,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
279
281
|
group_payload.merge!(params)
|
280
282
|
|
281
283
|
payload = {group: group_payload}
|
282
|
-
|
284
|
+
@account_groups_interface.setopts(options)
|
283
285
|
if options[:dry_run]
|
284
286
|
print_dry_run @account_groups_interface.dry.update(account['id'], group['id'], payload)
|
285
287
|
return
|
@@ -335,6 +337,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
335
337
|
end
|
336
338
|
new_zones = current_zones + [{'id' => cloud['id']}]
|
337
339
|
payload = {group: {id: group["id"], zones: new_zones}}
|
340
|
+
@account_groups_interface.setopts(options)
|
338
341
|
if options[:dry_run]
|
339
342
|
print_dry_run @account_groups_interface.dry.update_zones(account['id'], group["id"], payload)
|
340
343
|
return
|
@@ -391,6 +394,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
391
394
|
end
|
392
395
|
new_zones = current_zones.reject {|it| it["id"] == cloud["id"] }
|
393
396
|
payload = {group: {id: group["id"], zones: new_zones}}
|
397
|
+
@account_groups_interface.setopts(options)
|
394
398
|
if options[:dry_run]
|
395
399
|
print_dry_run @account_groups_interface.dry.update_zones(account['id'], group["id"], payload)
|
396
400
|
return
|
@@ -441,6 +445,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
441
445
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the group #{group['name']}?")
|
442
446
|
exit
|
443
447
|
end
|
448
|
+
@account_groups_interface.setopts(options)
|
444
449
|
if options[:dry_run]
|
445
450
|
print_dry_run @account_groups_interface.dry.destroy(account['id'], group['id'])
|
446
451
|
return
|
data/lib/morpheus/cli/apps.rb
CHANGED
@@ -1250,7 +1250,7 @@ class Morpheus::Cli::Apps
|
|
1250
1250
|
print_dry_run @apps_interface.dry.apply_security_groups(app['id'], payload)
|
1251
1251
|
return
|
1252
1252
|
end
|
1253
|
-
@apps_interface.apply_security_groups(app['id'],
|
1253
|
+
@apps_interface.apply_security_groups(app['id'], payload)
|
1254
1254
|
security_groups([args[0]])
|
1255
1255
|
rescue RestClient::Exception => e
|
1256
1256
|
print_rest_exception(e, options)
|
@@ -1273,6 +1273,11 @@ class Morpheus::Cli::Apps
|
|
1273
1273
|
opts.on( nil, '--output', "Display process output." ) do
|
1274
1274
|
options[:show_output] = true
|
1275
1275
|
end
|
1276
|
+
opts.on(nil, '--details', "Display more details. Shows everything, untruncated." ) do
|
1277
|
+
options[:show_events] = true
|
1278
|
+
options[:show_output] = true
|
1279
|
+
options[:details] = true
|
1280
|
+
end
|
1276
1281
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
1277
1282
|
opts.footer = "List historical processes for a specific app.\n" +
|
1278
1283
|
"[app] is required. This is the name or id of an app."
|
@@ -1361,8 +1366,8 @@ class Morpheus::Cli::Apps
|
|
1361
1366
|
startDate: format_local_dt(process_event['startDate']),
|
1362
1367
|
duration: format_process_duration(process_event),
|
1363
1368
|
status: format_process_status(process_event),
|
1364
|
-
error: format_process_error(process_event),
|
1365
|
-
output: format_process_output(process_event)
|
1369
|
+
error: format_process_error(process_event, options[:details] ? nil : 20),
|
1370
|
+
output: format_process_output(process_event, options[:details] ? nil : 20)
|
1366
1371
|
}
|
1367
1372
|
history_records << event_row
|
1368
1373
|
end
|
@@ -1565,8 +1570,8 @@ class Morpheus::Cli::Apps
|
|
1565
1570
|
|
1566
1571
|
def get_available_blueprints(refresh=false)
|
1567
1572
|
if !@available_blueprints || refresh
|
1568
|
-
results = @options_interface.options_for_source('appTemplates',{}) # still exists
|
1569
|
-
|
1573
|
+
#results = @options_interface.options_for_source('appTemplates',{}) # still exists
|
1574
|
+
results = @options_interface.options_for_source('blueprints',{})
|
1570
1575
|
@available_blueprints = results['data'].collect {|it|
|
1571
1576
|
{"id" => it["value"], "name" => it["name"], "value" => it["value"]}
|
1572
1577
|
}
|
@@ -76,7 +76,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
76
76
|
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
77
77
|
params[k] = options[k] unless options[k].nil?
|
78
78
|
end
|
79
|
-
|
79
|
+
@archive_buckets_interface.setopts(options)
|
80
80
|
if options[:dry_run]
|
81
81
|
print_dry_run @archive_buckets_interface.dry.list(params)
|
82
82
|
return
|
@@ -170,6 +170,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
170
170
|
bucket_id, search_file_path = parse_bucket_id_and_file_path(args[0])
|
171
171
|
connect(options)
|
172
172
|
begin
|
173
|
+
@archive_buckets_interface.setopts(options)
|
173
174
|
if options[:dry_run]
|
174
175
|
if args[0].to_s =~ /\A\d{1,}\Z/
|
175
176
|
print_dry_run @archive_buckets_interface.dry.get(bucket_id.to_i)
|
@@ -292,7 +293,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
292
293
|
return 1 if !archive_bucket_payload
|
293
294
|
payload = {'archiveBucket' => archive_bucket_payload}
|
294
295
|
end
|
295
|
-
|
296
|
+
@archive_buckets_interface.setopts(options)
|
296
297
|
if options[:dry_run]
|
297
298
|
print_dry_run @archive_buckets_interface.dry.create(payload)
|
298
299
|
return
|
@@ -371,7 +372,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
371
372
|
return 1 if !archive_bucket_payload
|
372
373
|
payload = {'archiveBucket' => archive_bucket_payload}
|
373
374
|
end
|
374
|
-
|
375
|
+
@archive_buckets_interface.setopts(options)
|
375
376
|
if options[:dry_run]
|
376
377
|
print_dry_run @archive_buckets_interface.dry.update(archive_bucket["id"], payload)
|
377
378
|
return
|
@@ -422,6 +423,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
422
423
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the archive bucket: #{archive_bucket['name']}?")
|
423
424
|
return 9, "aborted command"
|
424
425
|
end
|
426
|
+
@archive_buckets_interface.setopts(options)
|
425
427
|
if options[:dry_run]
|
426
428
|
print_dry_run @archive_buckets_interface.dry.destroy(archive_bucket['id'], query_params), full_command_string
|
427
429
|
return 0
|
@@ -565,6 +567,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
565
567
|
upload_file_list << {file: file, destination: destination}
|
566
568
|
end
|
567
569
|
|
570
|
+
@archive_buckets_interface.setopts(options)
|
568
571
|
if options[:dry_run]
|
569
572
|
# print_h1 "DRY RUN"
|
570
573
|
print "\n",cyan, bold, "Uploading #{upload_file_list.size} Files...", reset, "\n"
|
@@ -627,6 +630,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
627
630
|
return 9, "aborted command"
|
628
631
|
end
|
629
632
|
|
633
|
+
@archive_buckets_interface.setopts(options)
|
630
634
|
if options[:dry_run]
|
631
635
|
#print cyan,bold, " - Uploading #{file} to #{bucket_id}:#{destination} DRY RUN", reset, "\n"
|
632
636
|
# print_h1 "DRY RUN"
|
@@ -685,6 +689,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
685
689
|
if params[:phrase]
|
686
690
|
params[:fullTree] = true # these are not exclusively supported by api yet
|
687
691
|
end
|
692
|
+
@archive_buckets_interface.setopts(options)
|
688
693
|
if options[:dry_run]
|
689
694
|
print_dry_run @archive_buckets_interface.dry.list_files(bucket_id, search_file_path, params)
|
690
695
|
return
|
@@ -766,6 +771,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
766
771
|
[:phrase, :offset, :max, :sort, :direction, :fullTree].each do |k|
|
767
772
|
params[k] = options[k] unless options[k].nil?
|
768
773
|
end
|
774
|
+
@archive_buckets_interface.setopts(options)
|
769
775
|
if options[:dry_run]
|
770
776
|
print_dry_run @archive_buckets_interface.dry.list_files(bucket_id, search_file_path, params)
|
771
777
|
return 0
|
@@ -930,6 +936,8 @@ class Morpheus::Cli::ArchivesCommand
|
|
930
936
|
# archive_bucket = find_archive_bucket_by_name_or_id(bucket_id)
|
931
937
|
# return 1 if archive_bucket.nil?
|
932
938
|
params = {}
|
939
|
+
@archive_buckets_interface.setopts(options)
|
940
|
+
@archive_files_interface.setopts(options)
|
933
941
|
if options[:dry_run]
|
934
942
|
if file_id
|
935
943
|
print_dry_run @archive_files_interface.dry.get(file_id, params), full_command_string
|
@@ -1065,7 +1073,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1065
1073
|
return 9, "aborted command"
|
1066
1074
|
end
|
1067
1075
|
end
|
1068
|
-
|
1076
|
+
@archive_files_interface.setopts(options)
|
1069
1077
|
if options[:dry_run]
|
1070
1078
|
print_dry_run @archive_files_interface.dry.destroy(archive_file['id'], query_params)
|
1071
1079
|
return 0
|
@@ -1112,6 +1120,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1112
1120
|
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
1113
1121
|
params[k] = options[k] unless options[k].nil?
|
1114
1122
|
end
|
1123
|
+
@archive_files_interface.setopts(options)
|
1115
1124
|
if options[:dry_run]
|
1116
1125
|
print_dry_run @archive_files_interface.dry.history(archive_file['id'], params)
|
1117
1126
|
return
|
@@ -1174,6 +1183,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1174
1183
|
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
1175
1184
|
params[k] = options[k] unless options[k].nil?
|
1176
1185
|
end
|
1186
|
+
@archive_files_interface.setopts(options)
|
1177
1187
|
if options[:dry_run]
|
1178
1188
|
print_dry_run @archive_files_interface.dry.list_links(archive_file['id'], params)
|
1179
1189
|
return
|
@@ -1287,6 +1297,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1287
1297
|
end
|
1288
1298
|
end
|
1289
1299
|
begin
|
1300
|
+
@archive_files_interface.setopts(options)
|
1290
1301
|
if options[:dry_run]
|
1291
1302
|
# print_dry_run @archive_files_interface.dry.download_file_by_path(full_file_path), full_command_string
|
1292
1303
|
if use_public_url
|
@@ -1372,6 +1383,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1372
1383
|
archive_file = find_archive_file_by_bucket_and_path(bucket_id, file_path)
|
1373
1384
|
return 1 if archive_file.nil?
|
1374
1385
|
full_file_path = "#{bucket_id}/#{file_path}".squeeze('/')
|
1386
|
+
@archive_files_interface.setopts(options)
|
1375
1387
|
if options[:dry_run]
|
1376
1388
|
print_dry_run @archive_files_interface.dry.download_file_by_path(full_file_path), full_command_string
|
1377
1389
|
return 1
|
@@ -1421,6 +1433,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1421
1433
|
if expiration_seconds.to_i > 0
|
1422
1434
|
params['expireSeconds'] = expiration_seconds.to_i
|
1423
1435
|
end
|
1436
|
+
@archive_files_interface.setopts(options)
|
1424
1437
|
if options[:dry_run]
|
1425
1438
|
print_dry_run @archive_files_interface.dry.create_file_link(archive_file['id'], params)
|
1426
1439
|
return
|
@@ -1474,6 +1487,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1474
1487
|
return 1
|
1475
1488
|
end
|
1476
1489
|
params = {}
|
1490
|
+
@archive_files_interface.setopts(options)
|
1477
1491
|
if options[:dry_run]
|
1478
1492
|
print_dry_run @archive_files_interface.dry.destroy_file_link(archive_file['id'], link_id, params)
|
1479
1493
|
return
|
@@ -1561,7 +1575,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1561
1575
|
return 1
|
1562
1576
|
end
|
1563
1577
|
end
|
1564
|
-
|
1578
|
+
@archive_files_interface.setopts(options)
|
1565
1579
|
if options[:dry_run]
|
1566
1580
|
# print_dry_run @archive_files_interface.dry.download_file_by_path(full_file_path), full_command_string
|
1567
1581
|
print_dry_run @archive_files_interface.dry.download_file_by_link_chunked(link_key, outfile), full_command_string
|
@@ -1681,7 +1695,7 @@ class Morpheus::Cli::ArchivesCommand
|
|
1681
1695
|
return 1
|
1682
1696
|
end
|
1683
1697
|
end
|
1684
|
-
|
1698
|
+
@archive_buckets_interface.setopts(options)
|
1685
1699
|
if options[:dry_run]
|
1686
1700
|
print_dry_run @archive_buckets_interface.dry.download_bucket_zip_chunked(bucket_id, outfile), full_command_string
|
1687
1701
|
return 1
|
@@ -46,7 +46,7 @@ class Morpheus::Cli::BootScriptsCommand
|
|
46
46
|
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
47
47
|
params[k] = options[k] unless options[k].nil?
|
48
48
|
end
|
49
|
-
|
49
|
+
@boot_scripts_interface.setopts(options)
|
50
50
|
if options[:dry_run]
|
51
51
|
print_dry_run @boot_scripts_interface.dry.list(params)
|
52
52
|
return
|
@@ -105,6 +105,7 @@ class Morpheus::Cli::BootScriptsCommand
|
|
105
105
|
end
|
106
106
|
connect(options)
|
107
107
|
begin
|
108
|
+
@boot_scripts_interface.setopts(options)
|
108
109
|
if options[:dry_run]
|
109
110
|
if args[0].to_s =~ /\A\d{1,}\Z/
|
110
111
|
print_dry_run @boot_scripts_interface.dry.get(args[0].to_i)
|
@@ -183,6 +184,7 @@ class Morpheus::Cli::BootScriptsCommand
|
|
183
184
|
payload['bootScript']['content'] = File.read(script_file)
|
184
185
|
end
|
185
186
|
payload['bootScript'].merge!(params)
|
187
|
+
@boot_scripts_interface.setopts(options)
|
186
188
|
if options[:dry_run]
|
187
189
|
print_dry_run @boot_scripts_interface.dry.create(payload)
|
188
190
|
return
|
@@ -253,7 +255,7 @@ class Morpheus::Cli::BootScriptsCommand
|
|
253
255
|
payload['bootScript']['content'] = File.read(script_file)
|
254
256
|
end
|
255
257
|
payload['bootScript'].merge!(params)
|
256
|
-
|
258
|
+
@boot_scripts_interface.setopts(options)
|
257
259
|
if options[:dry_run]
|
258
260
|
print_dry_run @boot_scripts_interface.dry.update(boot_script["id"], payload)
|
259
261
|
return
|
@@ -296,6 +298,7 @@ class Morpheus::Cli::BootScriptsCommand
|
|
296
298
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the boot script: #{boot_script['fileName']}?")
|
297
299
|
return 9, "aborted command"
|
298
300
|
end
|
301
|
+
@boot_scripts_interface.setopts(options)
|
299
302
|
if options[:dry_run]
|
300
303
|
print_dry_run @boot_scripts_interface.dry.destroy(boot_script['id'])
|
301
304
|
return 0
|
@@ -567,12 +567,10 @@ module Morpheus
|
|
567
567
|
options[:dry_run] = true
|
568
568
|
options[:curl] = true
|
569
569
|
end
|
570
|
-
|
571
|
-
opts.add_hidden_option('--curl') if opts.is_a?(Morpheus::Cli::OptionParser)
|
572
|
-
opts.on(nil,'--scrub', "Mask secrets in output, such as the Authorization header. For use with --curl") do
|
570
|
+
opts.on(nil,'--scrub', "Mask secrets in output, such as the Authorization header. For use with --curl and --dry-run.") do
|
573
571
|
options[:scrub] = true
|
574
572
|
end
|
575
|
-
opts.add_hidden_option('--scrub') if opts.is_a?(Morpheus::Cli::OptionParser)
|
573
|
+
#opts.add_hidden_option('--scrub') if opts.is_a?(Morpheus::Cli::OptionParser)
|
576
574
|
when :quiet
|
577
575
|
opts.on('-q','--quiet', "No Output, do not print to stdout") do
|
578
576
|
options[:quiet] = true
|
@@ -54,6 +54,7 @@ class Morpheus::Cli::CloudDatastoresCommand
|
|
54
54
|
return 1 if cloud.nil?
|
55
55
|
|
56
56
|
params.merge!(parse_list_options(options))
|
57
|
+
@cloud_datastores_interface.setopts(options)
|
57
58
|
if options[:dry_run]
|
58
59
|
print_dry_run @cloud_datastores_interface.dry.list(cloud['id'], params)
|
59
60
|
return
|
@@ -137,7 +138,7 @@ class Morpheus::Cli::CloudDatastoresCommand
|
|
137
138
|
end
|
138
139
|
cloud = find_cloud_by_name_or_id(cloud_id)
|
139
140
|
return 1 if cloud.nil?
|
140
|
-
|
141
|
+
@cloud_datastores_interface.setopts(options)
|
141
142
|
if options[:dry_run]
|
142
143
|
if args[0].to_s =~ /\A\d{1,}\Z/
|
143
144
|
print_dry_run @cloud_datastores_interface.dry.get(cloud['id'], args[0].to_i)
|
@@ -325,7 +326,7 @@ class Morpheus::Cli::CloudDatastoresCommand
|
|
325
326
|
end
|
326
327
|
|
327
328
|
end
|
328
|
-
|
329
|
+
@cloud_datastores_interface.setopts(options)
|
329
330
|
if options[:dry_run]
|
330
331
|
print_dry_run @cloud_datastores_interface.dry.update(cloud['id'], datastore["id"], payload)
|
331
332
|
return
|
@@ -50,7 +50,7 @@ class Morpheus::Cli::AliasCommand
|
|
50
50
|
opts.footer = <<-EOT
|
51
51
|
Define a new alias.
|
52
52
|
[name] is required. This is the alias name. It should be one word.
|
53
|
-
[command] is required. This is the full command
|
53
|
+
[command] is required. This is the full command wrapped in quotes.
|
54
54
|
Aliases can be exported for future use with the -e option.
|
55
55
|
The `alias add` command can be invoked with `alias [name]=[command]`
|
56
56
|
|
@@ -58,9 +58,6 @@ Examples:
|
|
58
58
|
alias cloud=clouds
|
59
59
|
alias ij='instances get -j'
|
60
60
|
alias new-hosts='hosts list -S id -D'
|
61
|
-
alias infra='clouds list -m 5; networks list -m 5; hosts list -m 5'
|
62
|
-
alias find-answer='(instances get 42 || instances add) || echo "oh dear..."' -e
|
63
|
-
|
64
61
|
For more information, see https://github.com/gomorpheus/morpheus-cli/wiki/Alias
|
65
62
|
EOT
|
66
63
|
|
@@ -210,9 +207,8 @@ EOT
|
|
210
207
|
end
|
211
208
|
optparse.parse!(args)
|
212
209
|
|
213
|
-
#my_aliases = Morpheus::Cli::CliRegistry.all_aliases
|
214
210
|
my_aliases = Morpheus::Cli::CliRegistry.all_aliases.collect {|k,v|
|
215
|
-
{name: k,
|
211
|
+
{name: k, command: v}
|
216
212
|
}
|
217
213
|
|
218
214
|
# todo: generic support :list options on a local Array
|
@@ -220,7 +216,7 @@ EOT
|
|
220
216
|
# my_aliases = my_aliases.grep(/^#{Regexp.escape(options[:phrase])}/)
|
221
217
|
match_regex = /#{Regexp.escape(options[:phrase])}/
|
222
218
|
my_aliases = my_aliases.select {|it|
|
223
|
-
it[:name].to_s =~ match_regex || it[:
|
219
|
+
it[:name].to_s =~ match_regex || it[:command].to_s =~ match_regex
|
224
220
|
}
|
225
221
|
end
|
226
222
|
|
@@ -228,11 +224,11 @@ EOT
|
|
228
224
|
options[:direction] ||= 'asc'
|
229
225
|
|
230
226
|
if options[:sort]
|
231
|
-
if options[:sort].to_s == 'name'
|
227
|
+
if options[:sort].to_s == 'name' || options[:sort].to_s == 'alias'
|
232
228
|
my_aliases = my_aliases.sort {|x,y| x[:name].to_s.downcase <=> y[:name].to_s.downcase }
|
233
|
-
elsif options[:sort].to_s == '
|
229
|
+
elsif options[:sort].to_s == 'command' || options[:sort].to_s == 'command_string'
|
234
230
|
# just relies on the order they were registered in, heh...
|
235
|
-
my_aliases = my_aliases.sort {|x,y| x[:
|
231
|
+
my_aliases = my_aliases.sort {|x,y| x[:command].to_s.downcase <=> y[:command].to_s.downcase }
|
236
232
|
else
|
237
233
|
# a-z is the default, and the best
|
238
234
|
end
|
@@ -255,7 +251,7 @@ EOT
|
|
255
251
|
if options[:format] == 'json' || options[:json]
|
256
252
|
alias_json = {}
|
257
253
|
my_aliases.each do |it|
|
258
|
-
alias_json[it[:name]] = it[:
|
254
|
+
alias_json[it[:name]] = it[:command]
|
259
255
|
end
|
260
256
|
out << JSON.pretty_generate({aliases: alias_json})
|
261
257
|
out << "\n"
|
@@ -263,7 +259,7 @@ EOT
|
|
263
259
|
# out << "# morpheus aliases for #{`whoami`}\n" # windows!
|
264
260
|
#out << "# morpheus aliases\n"
|
265
261
|
my_aliases.each do |it|
|
266
|
-
out << "alias #{it[:name]}='#{it[:
|
262
|
+
out << "alias #{it[:name]}='#{it[:command]}'"
|
267
263
|
if do_export
|
268
264
|
out << " -e"
|
269
265
|
end
|
@@ -271,7 +267,7 @@ EOT
|
|
271
267
|
end
|
272
268
|
elsif options[:format] == 'list'
|
273
269
|
my_aliases.each do |it|
|
274
|
-
out << "#{cyan}#{it[:name]}#{reset}='#{it[:
|
270
|
+
out << "#{cyan}#{it[:name]}#{reset}='#{it[:command]}'"
|
275
271
|
out << "\n"
|
276
272
|
end
|
277
273
|
out << reset
|
@@ -279,7 +275,7 @@ EOT
|
|
279
275
|
# table (default)
|
280
276
|
alias_columns = {
|
281
277
|
"ALIAS" => lambda {|it| it[:name] },
|
282
|
-
"COMMAND" => lambda {|it| it[:
|
278
|
+
"COMMAND" => lambda {|it| it[:command] }
|
283
279
|
}
|
284
280
|
out << "\n"
|
285
281
|
out << cyan
|