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
@@ -385,14 +385,14 @@ class Morpheus::Cli::KeyPairs
|
|
385
385
|
dateCreated: format_local_dt(key_pair['dateCreated'])
|
386
386
|
}
|
387
387
|
end
|
388
|
-
|
389
|
-
tp rows, [
|
388
|
+
columns = [
|
390
389
|
:id,
|
391
390
|
:name,
|
392
391
|
{:fingerprint => {:width => 47} },
|
393
392
|
# {:md5 => {:width => 32} },
|
394
393
|
{:dateCreated => {:display_name => "Date Created"} }
|
395
394
|
]
|
395
|
+
print as_pretty_table(rows, columns, opts)
|
396
396
|
print reset
|
397
397
|
end
|
398
398
|
|
@@ -55,7 +55,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
55
55
|
option_type_lists = json_response['optionTypeLists']
|
56
56
|
subtitles = []
|
57
57
|
subtitles += parse_list_subtitles(options)
|
58
|
-
print_h1 "Morpheus Option Lists", subtitles
|
58
|
+
print_h1 "Morpheus Option Lists", subtitles, options
|
59
59
|
if option_type_lists.empty?
|
60
60
|
print cyan,"No option lists found.",reset,"\n"
|
61
61
|
else
|
@@ -68,17 +68,16 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
68
68
|
size: option_type_list['listItems'] ? option_type_list['listItems'].size : ''
|
69
69
|
}
|
70
70
|
end
|
71
|
-
print cyan
|
72
|
-
tp rows, [
|
73
|
-
:id,
|
74
|
-
:name,
|
75
|
-
:description,
|
76
|
-
:type,
|
77
|
-
:size
|
78
|
-
]
|
79
|
-
print reset
|
80
|
-
print_results_pagination(json_response)
|
81
71
|
end
|
72
|
+
columns = [
|
73
|
+
:id,
|
74
|
+
:name,
|
75
|
+
:description,
|
76
|
+
:type,
|
77
|
+
:size
|
78
|
+
]
|
79
|
+
print cyan
|
80
|
+
print as_pretty_table(rows, columns, options)
|
82
81
|
print reset,"\n"
|
83
82
|
rescue RestClient::Exception => e
|
84
83
|
print_rest_exception(e, options)
|
@@ -118,7 +117,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
118
117
|
return
|
119
118
|
end
|
120
119
|
|
121
|
-
print_h1 "Option List Details"
|
120
|
+
print_h1 "Option List Details", options
|
122
121
|
print cyan
|
123
122
|
if option_type_list['type'] == 'manual'
|
124
123
|
print_description_list({
|
@@ -151,7 +150,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
151
150
|
if source_headers && !source_headers.empty?
|
152
151
|
print cyan
|
153
152
|
print_h2 "Source Headers"
|
154
|
-
print as_pretty_table(source_headers, [:name, :value, :masked])
|
153
|
+
print as_pretty_table(source_headers, [:name, :value, :masked], options)
|
155
154
|
end
|
156
155
|
if !option_type_list['initialDataset'].empty?
|
157
156
|
print_h2 "Initial Dataset"
|
@@ -164,12 +163,7 @@ class Morpheus::Cli::LibraryOptionListsCommand
|
|
164
163
|
end
|
165
164
|
print_h2 "List Items"
|
166
165
|
if option_type_list['listItems']
|
167
|
-
|
168
|
-
# option_type_list['listItems'].each do |list_item|
|
169
|
-
# puts "\t#{list_item['name']}\t#{list_item['value']}"
|
170
|
-
# end
|
171
|
-
print cyan
|
172
|
-
tp option_type_list['listItems'], ['name', 'value']
|
166
|
+
print as_pretty_table(option_type_list['listItems'], ['name', 'value'], options)
|
173
167
|
else
|
174
168
|
puts "No data"
|
175
169
|
end
|
@@ -71,7 +71,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
|
|
71
71
|
}
|
72
72
|
end
|
73
73
|
print cyan
|
74
|
-
|
74
|
+
print as_pretty_table(rows, [
|
75
75
|
:id,
|
76
76
|
:name,
|
77
77
|
:type,
|
@@ -79,7 +79,7 @@ class Morpheus::Cli::LibraryOptionTypesCommand
|
|
79
79
|
{:fieldName => {:display_name => "Field Name"} },
|
80
80
|
:default,
|
81
81
|
:required
|
82
|
-
]
|
82
|
+
], options)
|
83
83
|
print reset
|
84
84
|
print_results_pagination(json_response)
|
85
85
|
end
|
data/lib/morpheus/cli/license.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'io/console'
|
3
3
|
require 'rest_client'
|
4
4
|
require 'optparse'
|
5
|
-
require 'table_print'
|
6
5
|
require 'morpheus/cli/cli_command'
|
7
6
|
|
8
7
|
class Morpheus::Cli::LoadBalancers
|
@@ -250,7 +249,7 @@ class Morpheus::Cli::LoadBalancers
|
|
250
249
|
lb_table_data = lb_types.collect do |lb_type|
|
251
250
|
{name: lb_type['name'], id: lb_type['id'], code: lb_type['code']}
|
252
251
|
end
|
253
|
-
|
252
|
+
print as_pretty_table(lb_table_data, [:id, :name, :code], options)
|
254
253
|
end
|
255
254
|
|
256
255
|
print reset,"\n"
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'table_print'
|
2
1
|
require 'morpheus/cli/mixins/print_helper'
|
3
2
|
|
4
3
|
# Mixin for Morpheus::Cli command classes
|
@@ -198,16 +197,16 @@ module Morpheus::Cli::AccountsHelper
|
|
198
197
|
dateCreated: format_local_dt(account['dateCreated'])
|
199
198
|
}
|
200
199
|
end
|
201
|
-
print table_color
|
202
|
-
|
200
|
+
print table_color if table_color
|
201
|
+
print as_pretty_table(rows, [
|
203
202
|
:id,
|
204
203
|
:name,
|
205
204
|
:description,
|
206
205
|
:role,
|
207
206
|
{:dateCreated => {:display_name => "Date Created"} },
|
208
207
|
:status
|
209
|
-
]
|
210
|
-
print reset
|
208
|
+
], options.merge({color:table_color}))
|
209
|
+
print reset if table_color
|
211
210
|
end
|
212
211
|
|
213
212
|
def format_role_type(role)
|
@@ -231,13 +230,6 @@ module Morpheus::Cli::AccountsHelper
|
|
231
230
|
|
232
231
|
def print_roles_table(roles, options={})
|
233
232
|
table_color = options.key?(:color) ? options[:color] : cyan
|
234
|
-
# tp roles, [
|
235
|
-
# 'id',
|
236
|
-
# 'name',
|
237
|
-
# 'description',
|
238
|
-
# 'scope',
|
239
|
-
# {'dateCreated' => {:display_name => "Date Created", :display_method => lambda{|it| format_local_dt(it['dateCreated']) } } }
|
240
|
-
# ]
|
241
233
|
rows = roles.collect do |role|
|
242
234
|
{
|
243
235
|
id: role['id'],
|
@@ -349,7 +349,7 @@ module Morpheus::Cli::PrintHelper
|
|
349
349
|
label = n_label || label
|
350
350
|
end
|
351
351
|
out_str = ""
|
352
|
-
string_key_values = {start_index: offset + 1, end_index: offset + size, total: total, size: size, offset: offset, label: label}
|
352
|
+
string_key_values = {start_index: format_number(offset + 1), end_index: format_number(offset + size), total: format_number(total), size: format_number(size), offset: format_number(offset), label: label}
|
353
353
|
if size > 0
|
354
354
|
if message
|
355
355
|
out_str << message % string_key_values
|
@@ -623,6 +623,57 @@ module Morpheus::Cli::PrintHelper
|
|
623
623
|
end
|
624
624
|
end
|
625
625
|
|
626
|
+
# responsive tables
|
627
|
+
# pops columns off end until they all fit on the terminal
|
628
|
+
# could use some options[:preferred_columns] logic here to throw away in some specified order
|
629
|
+
# --all fields disables this
|
630
|
+
trimmed_columns = []
|
631
|
+
if options[:responsive_table] != false && options[:include_fields].nil? && options[:all_fields] != true
|
632
|
+
|
633
|
+
begin
|
634
|
+
term_width = current_terminal_width()
|
635
|
+
table_width = columns.inject(0) {|acc, column_def| acc + (column_def.width || 0) }
|
636
|
+
table_width += ((columns.size-0) * (3)) # col border width
|
637
|
+
if term_width && table_width
|
638
|
+
# leave 1 column always...
|
639
|
+
while table_width > term_width && columns.size > 1
|
640
|
+
column_index = columns.size - 1
|
641
|
+
removed_column = columns.pop
|
642
|
+
trimmed_columns << removed_column
|
643
|
+
if removed_column.width
|
644
|
+
table_width -= removed_column.width
|
645
|
+
table_width -= 3 # col border width
|
646
|
+
end
|
647
|
+
|
648
|
+
# clear from data_matrix
|
649
|
+
# wel, nvm it just gets regenerated
|
650
|
+
|
651
|
+
end
|
652
|
+
end
|
653
|
+
rescue => ex
|
654
|
+
Morpheus::Logging::DarkPrinter.puts "Encountered error while applying responsive table sizing: (#{ex.class}) #{ex}"
|
655
|
+
end
|
656
|
+
|
657
|
+
if trimmed_columns.size > 0
|
658
|
+
# data_matrix = generate_table_data(data, columns, options)
|
659
|
+
header_row = []
|
660
|
+
columns.each do |column_def|
|
661
|
+
header_row << column_def.label
|
662
|
+
end
|
663
|
+
rows = []
|
664
|
+
data.each do |row_data|
|
665
|
+
row = []
|
666
|
+
columns.each do |column_def|
|
667
|
+
# r << column_def.display_method.respond_to?(:call) ? column_def.display_method.call(row_data) : get_object_value(row_data, column_def.display_method)
|
668
|
+
value = column_def.display_method.call(row_data)
|
669
|
+
row << value
|
670
|
+
end
|
671
|
+
rows << row
|
672
|
+
end
|
673
|
+
data_matrix = [header_row] + rows
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
626
677
|
# format header row
|
627
678
|
header_cells = []
|
628
679
|
columns.each_with_index do |column_def, column_index|
|
@@ -809,7 +860,7 @@ module Morpheus::Cli::PrintHelper
|
|
809
860
|
if v[:min_width]
|
810
861
|
column_def.min_width = v[:min_width]
|
811
862
|
end
|
812
|
-
# tp uses width to behave like max_width
|
863
|
+
# tp uses width to behave like max_width, but tp() is gone, remove this?
|
813
864
|
if v[:width]
|
814
865
|
column_def.width = v[:width]
|
815
866
|
column_def.max_width = v[:width]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -553,9 +552,7 @@ class Morpheus::Cli::NetworkDomainsCommand
|
|
553
552
|
rows = network_domains.collect do |network_domain|
|
554
553
|
{id: it['id'], name: it['name']}
|
555
554
|
end
|
556
|
-
|
557
|
-
tp rows, [:id, :name]
|
558
|
-
print reset,"\n"
|
555
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
559
556
|
return nil
|
560
557
|
else
|
561
558
|
return network_domains[0]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -580,12 +579,10 @@ class Morpheus::Cli::NetworkGroupsCommand
|
|
580
579
|
elsif network_groups.size > 1
|
581
580
|
print_red_alert "#{network_groups.size} network groups found by name #{name}"
|
582
581
|
# print_networks_table(networks, {color: red})
|
583
|
-
rows = network_groups.collect do |
|
582
|
+
rows = network_groups.collect do |it|
|
584
583
|
{id: it['id'], name: it['name']}
|
585
584
|
end
|
586
|
-
|
587
|
-
tp rows, [:id, :name]
|
588
|
-
print reset,"\n"
|
585
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
589
586
|
return nil
|
590
587
|
else
|
591
588
|
return network_groups[0]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -408,12 +407,10 @@ class Morpheus::Cli::NetworkPoolServersCommand
|
|
408
407
|
elsif network_pool_servers.size > 1
|
409
408
|
print_red_alert "#{network_pool_servers.size} network pool servers found by name #{name}"
|
410
409
|
# print_networks_table(networks, {color: red})
|
411
|
-
rows = network_pool_servers.collect do |
|
410
|
+
rows = network_pool_servers.collect do |it|
|
412
411
|
{id: it['id'], name: it['name']}
|
413
412
|
end
|
414
|
-
|
415
|
-
tp rows, [:id, :name]
|
416
|
-
print reset,"\n"
|
413
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
417
414
|
return nil
|
418
415
|
else
|
419
416
|
return network_pool_servers[0]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -473,12 +472,10 @@ class Morpheus::Cli::NetworkPoolsCommand
|
|
473
472
|
elsif network_pools.size > 1
|
474
473
|
print_red_alert "#{network_pools.size} network pools found by name #{name}"
|
475
474
|
# print_networks_table(networks, {color: red})
|
476
|
-
rows = network_pools.collect do |
|
475
|
+
rows = network_pools.collect do |it|
|
477
476
|
{id: it['id'], name: it['name']}
|
478
477
|
end
|
479
|
-
|
480
|
-
tp rows, [:id, :name]
|
481
|
-
print reset,"\n"
|
478
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
482
479
|
return nil
|
483
480
|
else
|
484
481
|
return network_pools[0]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -570,12 +569,10 @@ class Morpheus::Cli::NetworkProxiesCommand
|
|
570
569
|
elsif network_proxies.size > 1
|
571
570
|
print_red_alert "#{network_proxies.size} network proxies found by name #{name}"
|
572
571
|
# print_networks_table(networks, {color: red})
|
573
|
-
rows = network_proxies.collect do |
|
572
|
+
rows = network_proxies.collect do |it|
|
574
573
|
{id: it['id'], name: it['name']}
|
575
574
|
end
|
576
|
-
|
577
|
-
tp rows, [:id, :name]
|
578
|
-
print reset,"\n"
|
575
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
579
576
|
return nil
|
580
577
|
else
|
581
578
|
return network_proxies[0]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -127,12 +126,10 @@ class Morpheus::Cli::NetworkServicesCommand
|
|
127
126
|
elsif network_services.size > 1
|
128
127
|
print_red_alert "#{network_services.size} network services found by name #{name}"
|
129
128
|
# print_networks_table(networks, {color: red})
|
130
|
-
rows = network_services.collect do |
|
129
|
+
rows = network_services.collect do |it|
|
131
130
|
{id: it['id'], name: it['name']}
|
132
131
|
end
|
133
|
-
|
134
|
-
tp rows, [:id, :name]
|
135
|
-
print reset,"\n"
|
132
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
136
133
|
return nil
|
137
134
|
else
|
138
135
|
return network_services[0]
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
require 'optparse'
|
3
3
|
require 'filesize'
|
4
|
-
require 'table_print'
|
5
4
|
require 'morpheus/cli/cli_command'
|
6
5
|
require 'morpheus/cli/mixins/infrastructure_helper'
|
7
6
|
|
@@ -834,12 +833,10 @@ class Morpheus::Cli::NetworksCommand
|
|
834
833
|
elsif networks.size > 1
|
835
834
|
print_red_alert "#{networks.size} networks found by name #{name}"
|
836
835
|
# print_networks_table(networks, {color: red})
|
837
|
-
rows = networks.collect do |
|
836
|
+
rows = networks.collect do |it|
|
838
837
|
{id: it['id'], name: it['name']}
|
839
838
|
end
|
840
|
-
|
841
|
-
tp rows, [:id, :name]
|
842
|
-
print reset,"\n"
|
839
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
843
840
|
return nil
|
844
841
|
else
|
845
842
|
network = networks[0]
|
@@ -3,7 +3,6 @@ require 'yaml'
|
|
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/infrastructure_helper'
|
9
8
|
require 'morpheus/cli/mixins/accounts_helper'
|
@@ -908,9 +907,7 @@ class Morpheus::Cli::PoliciesCommand
|
|
908
907
|
rows = policies.collect do |policy|
|
909
908
|
{id: policy['id'], name: policy['name']}
|
910
909
|
end
|
911
|
-
|
912
|
-
tp rows, [:id, :name]
|
913
|
-
print reset,"\n"
|
910
|
+
puts as_pretty_table(rows, [:id, :name], {color:red})
|
914
911
|
return nil
|
915
912
|
else
|
916
913
|
policy = policies[0]
|