morpheus-cli 3.6.12 → 3.6.13
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/clouds_interface.rb +2 -2
- data/lib/morpheus/cli/account_groups_command.rb +84 -106
- data/lib/morpheus/cli/apps.rb +12 -11
- data/lib/morpheus/cli/archives_command.rb +2 -9
- data/lib/morpheus/cli/blueprints_command.rb +0 -8
- data/lib/morpheus/cli/boot_scripts_command.rb +3 -6
- data/lib/morpheus/cli/cli_command.rb +6 -2
- data/lib/morpheus/cli/cloud_datastores_command.rb +2 -5
- data/lib/morpheus/cli/clouds.rb +9 -10
- data/lib/morpheus/cli/commands/standard/history_command.rb +7 -3
- data/lib/morpheus/cli/containers_command.rb +0 -1
- data/lib/morpheus/cli/cypher_command.rb +0 -2
- data/lib/morpheus/cli/deployments.rb +6 -5
- data/lib/morpheus/cli/deploys.rb +0 -2
- data/lib/morpheus/cli/groups.rb +7 -10
- data/lib/morpheus/cli/hosts.rb +7 -4
- data/lib/morpheus/cli/image_builder_command.rb +1 -7
- data/lib/morpheus/cli/instances.rb +26 -40
- data/lib/morpheus/cli/key_pairs.rb +2 -2
- data/lib/morpheus/cli/library_option_lists_command.rb +13 -19
- data/lib/morpheus/cli/library_option_types_command.rb +2 -2
- data/lib/morpheus/cli/license.rb +0 -1
- data/lib/morpheus/cli/load_balancers.rb +1 -2
- data/lib/morpheus/cli/mixins/accounts_helper.rb +4 -12
- data/lib/morpheus/cli/mixins/print_helper.rb +53 -2
- data/lib/morpheus/cli/mixins/processes_helper.rb +0 -1
- data/lib/morpheus/cli/mixins/whoami_helper.rb +0 -1
- data/lib/morpheus/cli/monitoring_contacts_command.rb +0 -1
- data/lib/morpheus/cli/network_domains_command.rb +1 -4
- data/lib/morpheus/cli/network_groups_command.rb +2 -5
- data/lib/morpheus/cli/network_pool_servers_command.rb +2 -5
- data/lib/morpheus/cli/network_pools_command.rb +2 -5
- data/lib/morpheus/cli/network_proxies_command.rb +2 -5
- data/lib/morpheus/cli/network_services_command.rb +2 -5
- data/lib/morpheus/cli/networks_command.rb +2 -5
- data/lib/morpheus/cli/old_cypher_command.rb +0 -2
- data/lib/morpheus/cli/policies_command.rb +1 -4
- data/lib/morpheus/cli/preseed_scripts_command.rb +2 -5
- data/lib/morpheus/cli/remote.rb +3 -4
- data/lib/morpheus/cli/roles.rb +5 -5
- data/lib/morpheus/cli/security_group_rules.rb +0 -1
- data/lib/morpheus/cli/security_groups.rb +0 -1
- data/lib/morpheus/cli/shell.rb +89 -38
- data/lib/morpheus/cli/storage_providers_command.rb +2 -5
- data/lib/morpheus/cli/tasks.rb +2 -3
- data/lib/morpheus/cli/users.rb +1 -1
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/virtual_images.rb +4 -7
- data/lib/morpheus/cli/whoami.rb +1 -1
- data/lib/morpheus/cli/workflows.rb +0 -2
- data/lib/morpheus/formatters.rb +17 -0
- data/lib/morpheus/logging.rb +17 -7
- data/morpheus-cli.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fb19688b8a20fe1f3f2555769b6737f870ff8a82b5af0955cc5c369936d6b27
|
4
|
+
data.tar.gz: 38408f32dda58a1455c5c6acc04726b6787e94731b655ddb881ed512d2f4ee7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 563dcf0b9203f1894d5159f8d31b08c066a4aaa6de99da1a9509ad0f968be79aeac2be5e659822ca50c7c663acb5d3ce02becc693c3cf1157ec19f2442e487ab
|
7
|
+
data.tar.gz: e959d4df1d7c084f86417d69b502e4c731efb1cdf7e45eb70c2a2858aaad5fe9876dd524a185453deafc3ab01e1f051ba8ae989f89904412ecc576d44be1fdf1
|
@@ -8,9 +8,9 @@ class Morpheus::CloudsInterface < Morpheus::APIClient
|
|
8
8
|
@expires_at = expires_at
|
9
9
|
end
|
10
10
|
|
11
|
-
def cloud_types()
|
11
|
+
def cloud_types(params={})
|
12
12
|
url = "#{@base_url}/api/zone-types"
|
13
|
-
headers = { params:
|
13
|
+
headers = { params: params, authorization: "Bearer #{@access_token}" }
|
14
14
|
opts = {method: :get, url: url, headers: headers}
|
15
15
|
execute(opts)
|
16
16
|
end
|
@@ -3,7 +3,6 @@ require 'yaml'
|
|
3
3
|
require 'io/console'
|
4
4
|
require 'rest_client'
|
5
5
|
require 'optparse'
|
6
|
-
require 'table_print'
|
7
6
|
require 'morpheus/cli/cli_command'
|
8
7
|
require 'morpheus/cli/mixins/accounts_helper'
|
9
8
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
@@ -20,7 +19,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
20
19
|
# lives under image-builder domain right now
|
21
20
|
set_command_hidden
|
22
21
|
def command_name
|
23
|
-
"
|
22
|
+
"tenants groups"
|
24
23
|
end
|
25
24
|
|
26
25
|
def initialize()
|
@@ -44,18 +43,19 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
44
43
|
options = {}
|
45
44
|
params = {}
|
46
45
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
47
|
-
opts.banner = subcommand_usage()
|
48
|
-
build_common_options(opts, options, [:
|
49
|
-
opts.footer = "List
|
46
|
+
opts.banner = subcommand_usage("[tenant]")
|
47
|
+
build_common_options(opts, options, [:list, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
48
|
+
opts.footer = "List tenant groups."
|
50
49
|
end
|
51
50
|
optparse.parse!(args)
|
51
|
+
if args.count == 1
|
52
|
+
options[:account] = args[0]
|
53
|
+
else
|
54
|
+
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args}\n#{optparse}"
|
55
|
+
end
|
52
56
|
connect(options)
|
53
57
|
begin
|
54
58
|
# load account
|
55
|
-
if options[:account].nil? && options[:account_id].nil? && options[:account_name].nil?
|
56
|
-
puts_error "#{Morpheus::Terminal.angry_prompt}missing required option: -a [account]\n#{optparse}"
|
57
|
-
return 1
|
58
|
-
end
|
59
59
|
account = find_account_from_options(options)
|
60
60
|
return 1 if account.nil?
|
61
61
|
account_id = account['id']
|
@@ -78,14 +78,14 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
78
78
|
return 0
|
79
79
|
end
|
80
80
|
groups = json_response['groups']
|
81
|
-
title = "Morpheus Groups -
|
81
|
+
title = "Morpheus Groups - Tenant: #{account['name']}"
|
82
82
|
subtitles = []
|
83
83
|
subtitles += parse_list_subtitles(options)
|
84
|
-
print_h1 title, subtitles
|
84
|
+
print_h1 title, subtitles, options
|
85
85
|
if groups.empty?
|
86
86
|
print yellow,"No groups currently configured.",reset,"\n"
|
87
87
|
else
|
88
|
-
print_groups_table(groups)
|
88
|
+
print_groups_table(groups, options)
|
89
89
|
print_results_pagination(json_response)
|
90
90
|
end
|
91
91
|
print reset,"\n"
|
@@ -98,41 +98,39 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
98
98
|
def get(args)
|
99
99
|
options = {}
|
100
100
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
101
|
-
opts.banner = subcommand_usage("[group]")
|
102
|
-
build_common_options(opts, options, [:
|
103
|
-
opts.footer = "
|
101
|
+
opts.banner = subcommand_usage("[tenant] [group]")
|
102
|
+
build_common_options(opts, options, [:json, :yaml, :csv, :fields, :dry_run, :remote])
|
103
|
+
opts.footer = "Get details about a tenant group."
|
104
104
|
end
|
105
105
|
optparse.parse!(args)
|
106
|
-
if args.count
|
107
|
-
|
108
|
-
|
106
|
+
if args.count == 2
|
107
|
+
options[:account] = args[0]
|
108
|
+
options[:group] = args[1]
|
109
|
+
else
|
110
|
+
raise_command_error "wrong number of arguments, expected 2 and got (#{args.count}) #{args}\n#{optparse}"
|
109
111
|
end
|
110
112
|
connect(options)
|
111
113
|
begin
|
112
|
-
|
113
|
-
if options[:account].nil? && options[:account_id].nil? && options[:account_name].nil?
|
114
|
-
puts_error "#{Morpheus::Terminal.angry_prompt}missing required option: -a [account]\n#{optparse}"
|
115
|
-
return 1
|
116
|
-
end
|
114
|
+
|
117
115
|
account = find_account_from_options(options)
|
118
116
|
return 1 if account.nil?
|
119
117
|
account_id = account['id']
|
120
118
|
|
121
119
|
if options[:dry_run]
|
122
120
|
@account_groups_interface.setopts(options)
|
123
|
-
if
|
124
|
-
print_dry_run @account_groups_interface.dry.get(account_id,
|
121
|
+
if options[:group].to_s =~ /\A\d{1,}\Z/
|
122
|
+
print_dry_run @account_groups_interface.dry.get(account_id, options[:group].to_i)
|
125
123
|
else
|
126
|
-
print_dry_run @account_groups_interface.dry.get(account_id, {name:
|
124
|
+
print_dry_run @account_groups_interface.dry.get(account_id, {name: options[:group]})
|
127
125
|
end
|
128
126
|
return
|
129
127
|
end
|
130
128
|
|
131
|
-
group = find_account_group_by_name_or_id(account_id,
|
129
|
+
group = find_account_group_by_name_or_id(account_id, options[:group])
|
132
130
|
@account_groups_interface.setopts(options)
|
133
131
|
return 1 if group.nil?
|
134
132
|
# skip redundant request
|
135
|
-
# json_response = @account_groups_interface.dry.get(account_id,
|
133
|
+
# json_response = @account_groups_interface.dry.get(account_id, options[:group].to_i)
|
136
134
|
json_response = {"group" => group}
|
137
135
|
|
138
136
|
if options[:json]
|
@@ -146,7 +144,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
146
144
|
return 0
|
147
145
|
end
|
148
146
|
|
149
|
-
print_h1 "Group Details"
|
147
|
+
print_h1 "Group Details", options
|
150
148
|
print cyan
|
151
149
|
description_cols = {
|
152
150
|
"ID" => 'id',
|
@@ -179,35 +177,34 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
179
177
|
params = {}
|
180
178
|
use_it = false
|
181
179
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
182
|
-
opts.banner = subcommand_usage("[name]")
|
180
|
+
opts.banner = subcommand_usage("[tenant] [name]")
|
183
181
|
build_option_type_options(opts, options, add_group_option_types())
|
184
182
|
# opts.on( '-l', '--location LOCATION', "Location" ) do |val|
|
185
183
|
# params[:location] = val
|
186
184
|
# end
|
187
185
|
|
188
|
-
build_common_options(opts, options, [:
|
189
|
-
opts.footer = "Create a new
|
186
|
+
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
187
|
+
opts.footer = "Create a new tenant group."
|
190
188
|
end
|
191
189
|
optparse.parse!(args)
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
190
|
+
if args.count == 1
|
191
|
+
options[:account] = args[0]
|
192
|
+
elsif args.count == 2
|
193
|
+
options[:account] = args[0]
|
194
|
+
options[:group] = args[1]
|
195
|
+
else
|
196
|
+
raise_command_error "wrong number of arguments, expected 1-2 and got (#{args.count}) #{args}\n#{optparse}"
|
197
|
+
end
|
196
198
|
connect(options)
|
197
199
|
begin
|
198
|
-
# load account
|
199
|
-
if options[:account].nil? && options[:account_id].nil? && options[:account_name].nil?
|
200
|
-
puts_error "#{Morpheus::Terminal.angry_prompt}missing required option: -a [account]\n#{optparse}"
|
201
|
-
return 1
|
202
|
-
end
|
203
200
|
account = find_account_from_options(options)
|
204
201
|
return 1 if account.nil?
|
205
202
|
account_id = account['id']
|
206
203
|
|
207
204
|
group_payload = {}
|
208
|
-
if
|
209
|
-
group_payload[:name] =
|
210
|
-
options[:options]['name'] =
|
205
|
+
if options[:group]
|
206
|
+
group_payload[:name] = options[:group]
|
207
|
+
options[:options]['name'] = options[:group] # to skip prompt
|
211
208
|
end
|
212
209
|
if params[:location]
|
213
210
|
group_payload[:name] = params[:location]
|
@@ -242,31 +239,28 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
242
239
|
options = {}
|
243
240
|
params = {}
|
244
241
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
245
|
-
opts.banner = subcommand_usage("[group] [options]")
|
242
|
+
opts.banner = subcommand_usage("[tenant] [group] [options]")
|
246
243
|
build_option_type_options(opts, options, update_group_option_types())
|
247
244
|
# opts.on( '-l', '--location LOCATION', "Location" ) do |val|
|
248
245
|
# params[:location] = val
|
249
246
|
# end
|
250
247
|
build_common_options(opts, options, [:account, :options, :json, :dry_run, :remote])
|
251
|
-
opts.footer = "Update an existing
|
248
|
+
opts.footer = "Update an existing tenant group."
|
252
249
|
end
|
253
250
|
optparse.parse!(args)
|
254
|
-
if args.count
|
255
|
-
|
256
|
-
|
251
|
+
if args.count == 2
|
252
|
+
options[:account] = args[0]
|
253
|
+
options[:group] = args[1]
|
254
|
+
else
|
255
|
+
raise_command_error "wrong number of arguments, expected 2 and got (#{args.count}) #{args}\n#{optparse}"
|
257
256
|
end
|
258
257
|
connect(options)
|
259
258
|
begin
|
260
|
-
# load account
|
261
|
-
if options[:account].nil? && options[:account_id].nil? && options[:account_name].nil?
|
262
|
-
puts_error "#{Morpheus::Terminal.angry_prompt}missing required option: -a [account]\n#{optparse}"
|
263
|
-
return 1
|
264
|
-
end
|
265
259
|
account = find_account_from_options(options)
|
266
260
|
return 1 if account.nil?
|
267
261
|
account_id = account['id']
|
268
262
|
|
269
|
-
group = find_account_group_by_name_or_id(account_id,
|
263
|
+
group = find_account_group_by_name_or_id(account_id, options[:group])
|
270
264
|
return 1 if group.nil?
|
271
265
|
|
272
266
|
group_payload = {id: group['id']}
|
@@ -303,32 +297,30 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
303
297
|
def add_cloud(args)
|
304
298
|
options = {}
|
305
299
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
306
|
-
opts.banner = subcommand_usage("[group]
|
300
|
+
opts.banner = subcommand_usage("[tenant] [group] [cloud]")
|
307
301
|
build_common_options(opts, options, [:account, :json, :dry_run, :remote])
|
308
|
-
opts.footer = "Add a cloud to a group."
|
302
|
+
opts.footer = "Add a cloud to a tenant group."
|
309
303
|
end
|
310
304
|
optparse.parse!(args)
|
311
|
-
if args.count
|
312
|
-
|
313
|
-
|
305
|
+
if args.count == 3
|
306
|
+
options[:account] = args[0]
|
307
|
+
options[:group] = args[1]
|
308
|
+
options[:cloud] = args[2]
|
309
|
+
else
|
310
|
+
raise_command_error "wrong number of arguments, expected 3 and got (#{args.count}) #{args}\n#{optparse}"
|
314
311
|
end
|
315
312
|
connect(options)
|
316
313
|
begin
|
317
|
-
# load account
|
318
|
-
if options[:account].nil? && options[:account_id].nil? && options[:account_name].nil?
|
319
|
-
puts_error "#{Morpheus::Terminal.angry_prompt}missing required option: -a [account]\n#{optparse}"
|
320
|
-
return 1
|
321
|
-
end
|
322
314
|
account = find_account_from_options(options)
|
323
315
|
return 1 if account.nil?
|
324
316
|
account_id = account['id']
|
325
317
|
|
326
|
-
group = find_account_group_by_name_or_id(account_id,
|
318
|
+
group = find_account_group_by_name_or_id(account_id, options[:group])
|
327
319
|
return 1 if group.nil?
|
328
320
|
|
329
321
|
# err, this is going to find public clouds only, not those in the subaccount
|
330
322
|
# good enough for now?
|
331
|
-
cloud = find_cloud_by_name_or_id(
|
323
|
+
cloud = find_cloud_by_name_or_id(options[:cloud])
|
332
324
|
current_zones = group['zones']
|
333
325
|
found_zone = current_zones.find {|it| it["id"] == cloud["id"] }
|
334
326
|
if found_zone
|
@@ -360,32 +352,30 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
360
352
|
def remove_cloud(args)
|
361
353
|
options = {}
|
362
354
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
363
|
-
opts.banner = subcommand_usage("[group]
|
355
|
+
opts.banner = subcommand_usage("[tenant] [group] [cloud]")
|
364
356
|
build_common_options(opts, options, [:account, :json, :dry_run, :remote])
|
365
|
-
opts.footer = "Remove a cloud from a group."
|
357
|
+
opts.footer = "Remove a cloud from a tenant group."
|
366
358
|
end
|
367
359
|
optparse.parse!(args)
|
368
|
-
if args.count
|
369
|
-
|
370
|
-
|
360
|
+
if args.count == 3
|
361
|
+
options[:account] = args[0]
|
362
|
+
options[:group] = args[1]
|
363
|
+
options[:cloud] = args[2]
|
364
|
+
else
|
365
|
+
raise_command_error "wrong number of arguments, expected 3 and got (#{args.count}) #{args}\n#{optparse}"
|
371
366
|
end
|
372
367
|
connect(options)
|
373
368
|
begin
|
374
|
-
# load account
|
375
|
-
if options[:account].nil? && options[:account_id].nil? && options[:account_name].nil?
|
376
|
-
puts_error "#{Morpheus::Terminal.angry_prompt}missing required option: -a [account]\n#{optparse}"
|
377
|
-
return 1
|
378
|
-
end
|
379
369
|
account = find_account_from_options(options)
|
380
370
|
return 1 if account.nil?
|
381
371
|
account_id = account['id']
|
382
372
|
|
383
|
-
group = find_account_group_by_name_or_id(account_id,
|
373
|
+
group = find_account_group_by_name_or_id(account_id, options[:group])
|
384
374
|
return 1 if group.nil?
|
385
375
|
|
386
376
|
# err, this is going to find public clouds only, not those in the subaccount
|
387
377
|
# good enough for now?
|
388
|
-
cloud = find_cloud_by_name_or_id(
|
378
|
+
cloud = find_cloud_by_name_or_id(options[:cloud])
|
389
379
|
current_zones = group['zones']
|
390
380
|
found_zone = current_zones.find {|it| it["id"] == cloud["id"] }
|
391
381
|
if !found_zone
|
@@ -417,29 +407,25 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
417
407
|
def remove(args)
|
418
408
|
options = {}
|
419
409
|
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
420
|
-
opts.banner = subcommand_usage("[group]")
|
421
|
-
build_common_options(opts, options, [:
|
422
|
-
opts.footer = "Delete a group."
|
423
|
-
# more info to display here
|
410
|
+
opts.banner = subcommand_usage("[tenant] [group]")
|
411
|
+
build_common_options(opts, options, [:json, :dry_run, :auto_confirm, :remote])
|
412
|
+
opts.footer = "Delete a tenant group."
|
424
413
|
end
|
425
414
|
optparse.parse!(args)
|
426
|
-
if args.count
|
427
|
-
|
428
|
-
|
415
|
+
if args.count == 2
|
416
|
+
options[:account] = args[0]
|
417
|
+
options[:group] = args[1]
|
418
|
+
else
|
419
|
+
raise_command_error "wrong number of arguments, expected 2 and got (#{args.count}) #{args}\n#{optparse}"
|
429
420
|
end
|
430
421
|
connect(options)
|
431
422
|
|
432
423
|
begin
|
433
|
-
# load account
|
434
|
-
if options[:account].nil? && options[:account_id].nil? && options[:account_name].nil?
|
435
|
-
puts_error "#{Morpheus::Terminal.angry_prompt}missing required option: -a [account]\n#{optparse}"
|
436
|
-
return 1
|
437
|
-
end
|
438
424
|
account = find_account_from_options(options)
|
439
425
|
return 1 if account.nil?
|
440
426
|
account_id = account['id']
|
441
427
|
|
442
|
-
group = find_account_group_by_name_or_id(account_id,
|
428
|
+
group = find_account_group_by_name_or_id(account_id, options[:group])
|
443
429
|
return 1 if group.nil?
|
444
430
|
|
445
431
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the group #{group['name']}?")
|
@@ -467,13 +453,10 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
467
453
|
|
468
454
|
protected
|
469
455
|
|
470
|
-
def print_groups_table(groups,
|
471
|
-
table_color =
|
472
|
-
active_group_id = @active_group_id # Morpheus::Cli::Groups.active_group
|
456
|
+
def print_groups_table(groups, options={})
|
457
|
+
table_color = options[:color] || cyan
|
473
458
|
rows = groups.collect do |group|
|
474
|
-
is_active = @active_group_id && (@active_group_id == group['id'])
|
475
459
|
{
|
476
|
-
active: (is_active ? "=>" : ""),
|
477
460
|
id: group['id'],
|
478
461
|
name: group['name'],
|
479
462
|
location: group['location'],
|
@@ -482,7 +465,6 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
482
465
|
}
|
483
466
|
end
|
484
467
|
columns = [
|
485
|
-
{:active => {:display_name => ""}},
|
486
468
|
{:id => {:width => 10}},
|
487
469
|
{:name => {:width => 16}},
|
488
470
|
{:location => {:width => 32}},
|
@@ -490,7 +472,7 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
490
472
|
{:server_count => {:display_name => "Hosts"}}
|
491
473
|
]
|
492
474
|
print table_color
|
493
|
-
|
475
|
+
puts as_pretty_table(rows, columns, options)
|
494
476
|
print reset
|
495
477
|
end
|
496
478
|
|
@@ -542,13 +524,9 @@ class Morpheus::Cli::AccountGroupsCommand
|
|
542
524
|
return nil
|
543
525
|
elsif account_groups.size > 1
|
544
526
|
print_red_alert "#{account_groups.size} group found by name #{name}"
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
end
|
549
|
-
print red
|
550
|
-
tp rows, [:id, :name]
|
551
|
-
print reset,"\n"
|
527
|
+
rows = account_groups.collect { |it| {id: it['id'], name: it['name']} }
|
528
|
+
print "\n"
|
529
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
552
530
|
return nil
|
553
531
|
else
|
554
532
|
account_group = account_groups[0]
|
data/lib/morpheus/cli/apps.rb
CHANGED
@@ -3,7 +3,6 @@ require 'io/console'
|
|
3
3
|
require 'rest_client'
|
4
4
|
require 'optparse'
|
5
5
|
require 'filesize'
|
6
|
-
require 'table_print'
|
7
6
|
require 'morpheus/cli/cli_command'
|
8
7
|
require 'morpheus/cli/mixins/accounts_helper'
|
9
8
|
require 'morpheus/cli/mixins/provisioning_helper'
|
@@ -1487,6 +1486,12 @@ class Morpheus::Cli::Apps
|
|
1487
1486
|
cpu_usage_str = !stats ? "" : generate_usage_bar((stats['cpuUsage'] || stats['cpuUsagePeak']).to_f, 100, {max_bars: 10})
|
1488
1487
|
memory_usage_str = !stats ? "" : generate_usage_bar(stats['usedMemory'], stats['maxMemory'], {max_bars: 10})
|
1489
1488
|
storage_usage_str = !stats ? "" : generate_usage_bar(stats['usedStorage'], stats['maxStorage'], {max_bars: 10})
|
1489
|
+
# if stats['maxMemory'] && stats['maxMemory'].to_i != 0
|
1490
|
+
# memory_usage_str = memory_usage_str + cyan + format_bytes_short(stats['usedMemory']).strip.rjust(7, ' ') + " / " + format_bytes_short(stats['maxMemory']).strip
|
1491
|
+
# end
|
1492
|
+
# if stats['maxStorage'] && stats['maxStorage'].to_i != 0
|
1493
|
+
# storage_usage_str = storage_usage_str + cyan + format_bytes_short(stats['usedStorage']).strip.rjust(7, ' ') + " / " + format_bytes_short(stats['maxStorage']).strip
|
1494
|
+
# end
|
1490
1495
|
{
|
1491
1496
|
id: app['id'],
|
1492
1497
|
name: app['name'],
|
@@ -1512,23 +1517,19 @@ class Morpheus::Cli::Apps
|
|
1512
1517
|
:containers,
|
1513
1518
|
#:account,
|
1514
1519
|
:status,
|
1515
|
-
#{:dateCreated => {:display_name => "Date Created"} }
|
1520
|
+
#{:dateCreated => {:display_name => "Date Created"} },
|
1521
|
+
{:cpu => {:display_name => "MAX CPU"} },
|
1522
|
+
:memory,
|
1523
|
+
:storage
|
1516
1524
|
]
|
1517
|
-
|
1518
|
-
if term_width > 120
|
1519
|
-
columns += [
|
1520
|
-
{:cpu => {:display_name => "MAX CPU"} },
|
1521
|
-
:memory,
|
1522
|
-
:storage
|
1523
|
-
]
|
1524
|
-
end
|
1525
|
+
|
1525
1526
|
# custom pretty table columns ...
|
1526
1527
|
# if options[:include_fields]
|
1527
1528
|
# columns = options[:include_fields]
|
1528
1529
|
# end
|
1529
1530
|
# print cyan
|
1530
1531
|
print as_pretty_table(rows, columns, opts) #{color: table_color}
|
1531
|
-
print reset
|
1532
|
+
print reset,"\n"
|
1532
1533
|
end
|
1533
1534
|
|
1534
1535
|
def format_app_status(app, return_color=cyan)
|