morpheus-cli 5.5.1.4 → 5.5.2
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/Dockerfile +1 -1
- data/lib/morpheus/api/api_client.rb +25 -0
- data/lib/morpheus/api/archive_buckets_interface.rb +1 -1
- data/lib/morpheus/api/body_io.rb +22 -0
- data/lib/morpheus/api/catalog_item_types_interface.rb +5 -1
- data/lib/morpheus/api/clients_interface.rb +41 -0
- data/lib/morpheus/api/clouds_interface.rb +21 -0
- data/lib/morpheus/api/instances_interface.rb +8 -1
- data/lib/morpheus/api/integrations_interface.rb +30 -0
- data/lib/morpheus/api/library_instance_types_interface.rb +15 -3
- data/lib/morpheus/api/network_pool_server_types_interface.rb +9 -0
- data/lib/morpheus/api/plugins_interface.rb +22 -0
- data/lib/morpheus/api/roles_interface.rb +20 -1
- data/lib/morpheus/api/security_package_types_interface.rb +9 -0
- data/lib/morpheus/api/security_packages_interface.rb +9 -0
- data/lib/morpheus/api/security_scans_interface.rb +9 -0
- data/lib/morpheus/api/servers_interface.rb +17 -17
- data/lib/morpheus/api/storage_providers_interface.rb +1 -1
- data/lib/morpheus/api/virtual_images_interface.rb +1 -23
- data/lib/morpheus/cli/cli_command.rb +81 -7
- data/lib/morpheus/cli/commands/apps.rb +28 -2
- data/lib/morpheus/cli/commands/archives_command.rb +2 -2
- data/lib/morpheus/cli/commands/blueprints_command.rb +16 -0
- data/lib/morpheus/cli/commands/catalog_item_types_command.rb +34 -2
- data/lib/morpheus/cli/commands/clients_command.rb +338 -0
- data/lib/morpheus/cli/commands/clouds.rb +127 -1
- data/lib/morpheus/cli/commands/clusters.rb +42 -12
- data/lib/morpheus/cli/commands/curl_command.rb +114 -135
- data/lib/morpheus/cli/commands/hosts.rb +108 -11
- data/lib/morpheus/cli/commands/instances.rb +115 -14
- data/lib/morpheus/cli/commands/integrations_command.rb +215 -4
- data/lib/morpheus/cli/commands/invoices_command.rb +20 -11
- data/lib/morpheus/cli/commands/jobs_command.rb +299 -190
- data/lib/morpheus/cli/commands/library_cluster_layouts_command.rb +16 -2
- data/lib/morpheus/cli/commands/library_container_scripts_command.rb +14 -0
- data/lib/morpheus/cli/commands/library_container_templates_command.rb +131 -48
- data/lib/morpheus/cli/commands/library_container_types_command.rb +17 -4
- data/lib/morpheus/cli/commands/library_instance_types_command.rb +85 -7
- data/lib/morpheus/cli/commands/library_layouts_command.rb +32 -1
- data/lib/morpheus/cli/commands/library_option_lists_command.rb +30 -18
- data/lib/morpheus/cli/commands/library_option_types_command.rb +31 -14
- data/lib/morpheus/cli/commands/library_spec_templates_command.rb +14 -0
- data/lib/morpheus/cli/commands/library_upgrades_command.rb +2 -2
- data/lib/morpheus/cli/commands/network_pool_server_types.rb +20 -0
- data/lib/morpheus/cli/commands/network_pool_servers_command.rb +55 -158
- data/lib/morpheus/cli/commands/network_pools_command.rb +49 -23
- data/lib/morpheus/cli/commands/networks_command.rb +262 -45
- data/lib/morpheus/cli/commands/plugins.rb +213 -0
- data/lib/morpheus/cli/commands/price_sets_command.rb +40 -10
- data/lib/morpheus/cli/commands/prices_command.rb +17 -5
- data/lib/morpheus/cli/commands/processes_command.rb +2 -1
- data/lib/morpheus/cli/commands/remote.rb +7 -10
- data/lib/morpheus/cli/commands/roles.rb +924 -335
- data/lib/morpheus/cli/commands/search_command.rb +2 -0
- data/lib/morpheus/cli/commands/security_groups.rb +72 -84
- data/lib/morpheus/cli/commands/security_package_types.rb +32 -0
- data/lib/morpheus/cli/commands/security_packages.rb +84 -0
- data/lib/morpheus/cli/commands/security_scans.rb +107 -0
- data/lib/morpheus/cli/commands/service_plans_command.rb +16 -14
- data/lib/morpheus/cli/commands/subnets_command.rb +15 -1
- data/lib/morpheus/cli/commands/tasks.rb +34 -1
- data/lib/morpheus/cli/commands/tenants_command.rb +1 -1
- data/lib/morpheus/cli/commands/user_settings_command.rb +11 -2
- data/lib/morpheus/cli/commands/users.rb +50 -9
- data/lib/morpheus/cli/commands/virtual_images.rb +14 -0
- data/lib/morpheus/cli/commands/workflows.rb +14 -0
- data/lib/morpheus/cli/mixins/accounts_helper.rb +6 -5
- data/lib/morpheus/cli/mixins/infrastructure_helper.rb +79 -0
- data/lib/morpheus/cli/mixins/jobs_helper.rb +4 -5
- data/lib/morpheus/cli/mixins/library_helper.rb +2 -0
- data/lib/morpheus/cli/mixins/logs_helper.rb +3 -0
- data/lib/morpheus/cli/mixins/monitoring_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/print_helper.rb +29 -4
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +38 -9
- data/lib/morpheus/cli/mixins/rest_command.rb +106 -8
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +6 -2
- data/lib/morpheus/cli/option_types.rb +94 -25
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/formatters.rb +10 -1
- metadata +15 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::PluginsCommand
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
|
|
7
|
+
set_command_name :plugins
|
|
8
|
+
set_command_description "View and manage plugins."
|
|
9
|
+
register_subcommands :list, :get, :upload, :update, :remove, :'check-updates'
|
|
10
|
+
|
|
11
|
+
# RestCommand settings
|
|
12
|
+
register_interfaces :plugins
|
|
13
|
+
|
|
14
|
+
def upload(args)
|
|
15
|
+
options = {}
|
|
16
|
+
params = {}
|
|
17
|
+
filename = nil
|
|
18
|
+
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
|
19
|
+
opts.banner = subcommand_usage("[name] [file]")
|
|
20
|
+
build_standard_post_options(opts, options)
|
|
21
|
+
opts.footer = <<-EOT
|
|
22
|
+
Upload a plugin file.
|
|
23
|
+
[file] is required. This is the path of the .jar file to upload
|
|
24
|
+
This can be used to install and register a new plugin and also
|
|
25
|
+
to update an existing plugin to a new version.
|
|
26
|
+
EOT
|
|
27
|
+
end
|
|
28
|
+
optparse.parse!(args)
|
|
29
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
|
30
|
+
connect(options)
|
|
31
|
+
filename = args[0]
|
|
32
|
+
filename = File.expand_path(filename)
|
|
33
|
+
if !File.exists?(filename)
|
|
34
|
+
raise_command_error "File not found: #{filename}"
|
|
35
|
+
elsif !File.file?(filename)
|
|
36
|
+
raise_command_error "File is a directory: #{filename}"
|
|
37
|
+
end
|
|
38
|
+
plugin_file = File.new(filename, 'rb')
|
|
39
|
+
@plugins_interface.setopts(options)
|
|
40
|
+
if options[:dry_run]
|
|
41
|
+
print_dry_run @plugins_interface.dry.upload(plugin_file)
|
|
42
|
+
return
|
|
43
|
+
end
|
|
44
|
+
json_response = @plugins_interface.upload(plugin_file)
|
|
45
|
+
render_response(json_response, options) do
|
|
46
|
+
plugin = json_response[rest_object_key]
|
|
47
|
+
print_green_success "Uploaded plugin #{plugin['name']} (#{plugin['version']})"
|
|
48
|
+
# _get(plugin['id'], {}, options)
|
|
49
|
+
end
|
|
50
|
+
return 0, nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def check_updates(args)
|
|
54
|
+
options = {}
|
|
55
|
+
params = {}
|
|
56
|
+
filename = nil
|
|
57
|
+
optparse = Morpheus::Cli::OptionParser.new do|opts|
|
|
58
|
+
opts.banner = subcommand_usage("[name] [file]")
|
|
59
|
+
build_standard_post_options(opts, options)
|
|
60
|
+
opts.footer = <<-EOT
|
|
61
|
+
Check for installed plugins that have available updates.
|
|
62
|
+
EOT
|
|
63
|
+
end
|
|
64
|
+
optparse.parse!(args)
|
|
65
|
+
verify_args!(args:args, optparse:optparse, count:0)
|
|
66
|
+
connect(options)
|
|
67
|
+
params.merge!(parse_query_options(options))
|
|
68
|
+
payload = parse_payload(options)
|
|
69
|
+
@plugins_interface.setopts(options)
|
|
70
|
+
if options[:dry_run]
|
|
71
|
+
print_dry_run @plugins_interface.dry.check_updates(payload, params)
|
|
72
|
+
return
|
|
73
|
+
end
|
|
74
|
+
json_response = @plugins_interface.check_updates(payload, params)
|
|
75
|
+
render_response(json_response, options) do
|
|
76
|
+
plugins_to_update = json_response['pluginsToUpdate'] || []
|
|
77
|
+
if plugins_to_update.size == 1
|
|
78
|
+
print_green_success("1 plugin has an available update")
|
|
79
|
+
else
|
|
80
|
+
print_green_success("#{plugins_to_update.size} plugins have available updates")
|
|
81
|
+
end
|
|
82
|
+
if plugins_to_update.size > 0
|
|
83
|
+
print_h2 "Plugins To Update", options
|
|
84
|
+
puts as_pretty_table(plugins_to_update, [:id, :name])
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
return 0, nil
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
protected
|
|
91
|
+
|
|
92
|
+
def build_list_options(opts, options, params)
|
|
93
|
+
opts.on('--name VALUE', String, "Filter by name") do |val|
|
|
94
|
+
add_query_parameter(params, 'name', val)
|
|
95
|
+
end
|
|
96
|
+
opts.on('--code VALUE', String, "Filter by code") do |val|
|
|
97
|
+
add_query_parameter(params, 'code', val)
|
|
98
|
+
end
|
|
99
|
+
opts.on('--version VALUE', String, "Filter by version") do |val|
|
|
100
|
+
add_query_parameter(params, 'version', val)
|
|
101
|
+
end
|
|
102
|
+
opts.on('--status VALUE', String, "Filter by status") do |val|
|
|
103
|
+
add_query_parameter(params, 'status', val)
|
|
104
|
+
end
|
|
105
|
+
opts.on('--enabled [true|false]', String, "Filter by enabled [true|false]") do |val|
|
|
106
|
+
params['enabled'] = ['true','on','1',''].include?(val.to_s.downcase)
|
|
107
|
+
end
|
|
108
|
+
opts.on('--valid [true|false]', String, "Filter by valid [true|false]") do |val|
|
|
109
|
+
params['valid'] = ['true','on','1',''].include?(val.to_s.downcase)
|
|
110
|
+
end
|
|
111
|
+
opts.on('--has-update [true|false]', String, "Filter by hasValidUpdate [true|false]") do |val|
|
|
112
|
+
params['hasValidUpdate'] = ['true','on','1',''].include?(val.to_s.downcase)
|
|
113
|
+
end
|
|
114
|
+
super
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def render_response_for_get(json_response, options)
|
|
118
|
+
render_response(json_response, options, rest_object_key) do
|
|
119
|
+
record = json_response[rest_object_key]
|
|
120
|
+
print_h1 rest_label, [], options
|
|
121
|
+
print cyan
|
|
122
|
+
print_description_list(rest_column_definitions(options), record, options)
|
|
123
|
+
if record['statusMessage'].to_s != ''
|
|
124
|
+
print_h2 "Status Message", options
|
|
125
|
+
if record['status'].to_s.downcase == 'error'
|
|
126
|
+
print red, record['statusMessage'], reset, "\n"
|
|
127
|
+
else
|
|
128
|
+
print record['statusMessage'], "\n"
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
# Plugin Providers
|
|
132
|
+
providers = record['providers']
|
|
133
|
+
if providers && !providers.empty?
|
|
134
|
+
print_h2 "Providers"
|
|
135
|
+
print as_pretty_table(providers, [:name, :type], options)
|
|
136
|
+
end
|
|
137
|
+
# Plugin Configuration
|
|
138
|
+
option_types = record["optionTypes"].sort {|a,b| a['displayOrder'].to_i <=> b['displayOrder'].to_i}
|
|
139
|
+
config = record['config'] || {}
|
|
140
|
+
if option_types && !option_types.empty?
|
|
141
|
+
print_h2 "Configuration"
|
|
142
|
+
rows = option_types.collect do |option_type|
|
|
143
|
+
{:label => option_type['fieldLabel'], :name => option_type['fieldName'], :value => config[option_type['fieldName']]}
|
|
144
|
+
end
|
|
145
|
+
print as_pretty_table(rows, [:label, :name, :value], options)
|
|
146
|
+
end
|
|
147
|
+
print reset,"\n"
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def plugin_list_column_definitions(options)
|
|
152
|
+
{
|
|
153
|
+
"ID" => 'id',
|
|
154
|
+
"Name" => 'name',
|
|
155
|
+
# "Code" => 'code',
|
|
156
|
+
"Description" => 'description',
|
|
157
|
+
"Version" => lambda {|it| it['version'] },
|
|
158
|
+
"Enabled" => lambda {|it| format_boolean it['enabled'] },
|
|
159
|
+
"Status" => lambda {|it| format_plugin_status(it) },
|
|
160
|
+
}
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def plugin_column_definitions(options)
|
|
164
|
+
{
|
|
165
|
+
"ID" => 'id',
|
|
166
|
+
"Name" => 'name',
|
|
167
|
+
"Code" => 'code',
|
|
168
|
+
"Description" => 'description',
|
|
169
|
+
"Version" => lambda {|it| it['version'] },
|
|
170
|
+
"Author" => 'author',
|
|
171
|
+
"Enabled" => lambda {|it| format_boolean it['enabled'] },
|
|
172
|
+
"Valid" => lambda {|it| format_boolean it['valid'] },
|
|
173
|
+
"Has Update?" => lambda {|it| format_boolean it['hasValidUpdate'] },
|
|
174
|
+
"Status" => lambda {|it| format_plugin_status(it) },
|
|
175
|
+
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
|
176
|
+
"Updated" => lambda {|it| format_local_dt(it['lastUpdated']) },
|
|
177
|
+
}
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def add_plugin_option_types()
|
|
181
|
+
[
|
|
182
|
+
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true},
|
|
183
|
+
]
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def add_plugin_advanced_option_types()
|
|
187
|
+
[]
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def update_plugin_option_types()
|
|
191
|
+
option_types = add_plugin_option_types.collect {|it| it.delete('required'); it.delete('defaultValue'); it.delete('dependsOnCode'); it }
|
|
192
|
+
option_types.reject! {|it| it['fieldName'] == 'type' }
|
|
193
|
+
option_types
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
def update_plugin_advanced_option_types()
|
|
197
|
+
add_plugin_advanced_option_types().collect {|it| it.delete('required'); it.delete('defaultValue'); it.delete('dependsOnCode'); it }
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
def format_plugin_status(plugin, return_color=cyan)
|
|
201
|
+
out = ""
|
|
202
|
+
status_string = plugin['status'].to_s.downcase
|
|
203
|
+
if status_string == 'loaded'
|
|
204
|
+
out << "#{green}#{status_string.upcase}#{return_color}"
|
|
205
|
+
elsif status_string == 'error'
|
|
206
|
+
out << "#{red}#{status_string ? status_string.upcase : 'N/A'}#{plugin['statusMessage'] ? "#{return_color} - #{plugin['statusMessage']}" : ''}#{return_color}"
|
|
207
|
+
else
|
|
208
|
+
out << "#{cyan}#{status_string.upcase}#{return_color}"
|
|
209
|
+
end
|
|
210
|
+
out
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
end
|
|
@@ -31,6 +31,9 @@ class Morpheus::Cli::PriceSetsCommand
|
|
|
31
31
|
params = {'includeZones': true}
|
|
32
32
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
33
33
|
opts.banner = subcommand_usage()
|
|
34
|
+
opts.on('-t', '--type TYPE', String, "Filter by type") do |val|
|
|
35
|
+
add_query_parameter(params, 'type', parse_array(val).collect {|it| get_price_set_type_code(it) })
|
|
36
|
+
end
|
|
34
37
|
opts.on('-i', '--include-inactive [on|off]', String, "Can be used to enable / disable inactive filter. Default is on") do |val|
|
|
35
38
|
params['includeInactive'] = val.to_s == 'on' || val.to_s == 'true' || val.to_s == '1' || val.to_s == ''
|
|
36
39
|
end
|
|
@@ -193,7 +196,7 @@ class Morpheus::Cli::PriceSetsCommand
|
|
|
193
196
|
end
|
|
194
197
|
end
|
|
195
198
|
opts.on('-t', "--type [TYPE]", String, "Price set type") do |val|
|
|
196
|
-
if ['fixed', 'compute_plus_storage', 'component'].include?(val)
|
|
199
|
+
if ['fixed', 'compute_plus_storage', 'component','load_balancer','snapshot','virtual_image','software_or_service'].include?(val)
|
|
197
200
|
params['type'] = val
|
|
198
201
|
else
|
|
199
202
|
raise_command_error "Unrecognized price set type #{val}"
|
|
@@ -268,7 +271,9 @@ class Morpheus::Cli::PriceSetsCommand
|
|
|
268
271
|
end
|
|
269
272
|
|
|
270
273
|
# type
|
|
271
|
-
|
|
274
|
+
price_set_type_options = price_set_types.collect {|k,v| {'name' => v[:label], 'value' => k} }
|
|
275
|
+
params['type'] ||= Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'type' => 'select', 'fieldLabel' => 'Price Set Type', 'selectOptions' => price_set_type_options, 'required' => true, 'description' => 'Price Set Type.'}],options[:options],@api_client,{}, options[:no_prompt])['type']
|
|
276
|
+
|
|
272
277
|
if params['type'].nil?
|
|
273
278
|
print_red_alert "Type is required"
|
|
274
279
|
exit 1
|
|
@@ -491,20 +496,31 @@ class Morpheus::Cli::PriceSetsCommand
|
|
|
491
496
|
end
|
|
492
497
|
|
|
493
498
|
def price_set_type_label(type)
|
|
494
|
-
price_set_types[type]
|
|
499
|
+
price_set_type = price_set_types[type]
|
|
500
|
+
if price_set_type.nil?
|
|
501
|
+
type.capitalize
|
|
502
|
+
else
|
|
503
|
+
price_set_type[:label]
|
|
504
|
+
end
|
|
495
505
|
end
|
|
496
506
|
|
|
497
|
-
def
|
|
507
|
+
def price_types
|
|
498
508
|
{
|
|
499
509
|
'fixed' => 'Everything',
|
|
500
510
|
'compute' => 'Memory + CPU',
|
|
501
|
-
'memory' => 'Memory Only
|
|
502
|
-
'cores' => 'Cores Only
|
|
503
|
-
'storage' => 'Disk Only
|
|
504
|
-
'datastore' => 'Datastore
|
|
511
|
+
'memory' => 'Memory Only',
|
|
512
|
+
'cores' => 'Cores Only',
|
|
513
|
+
'storage' => 'Disk Only',
|
|
514
|
+
'datastore' => 'Datastore',
|
|
505
515
|
'platform' => 'Platform',
|
|
506
|
-
'software' => 'Software'
|
|
507
|
-
|
|
516
|
+
'software' => 'Software',
|
|
517
|
+
'load_balancer' => 'Load Balancer',
|
|
518
|
+
'load_balancer_virtual_server' => 'Load Balancer Virtual Server',
|
|
519
|
+
}
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
def price_type_label(type)
|
|
523
|
+
price_types[type] || type.capitalize
|
|
508
524
|
end
|
|
509
525
|
|
|
510
526
|
def price_units
|
|
@@ -516,9 +532,23 @@ class Morpheus::Cli::PriceSetsCommand
|
|
|
516
532
|
'fixed' => {:label => 'Everything', :requires => ['fixed'], :allows => ['platform', 'software']},
|
|
517
533
|
'compute_plus_storage' => {:label => 'Compute + Storage', :requires => ['compute', 'storage'], :allows => ['platform', 'software']},
|
|
518
534
|
'component' => {:label => 'Component', :requires => ['memory', 'cores', 'storage'], :allows => ['platform', 'software']},
|
|
535
|
+
'load_balancer' => {:label => 'Load Balancer', :requires => ['load_balancer'], :allows => ['load_balancer_virtual_server']},
|
|
536
|
+
'snapshot' => {:label => 'Snapshot', :requires => ['storage'], :allows => ['storage', 'datastore']},
|
|
537
|
+
'virtual_image' => {:label => 'Virtual Image', :requires => ['storage'], :allows => []},
|
|
538
|
+
'software_or_service' => {:label => 'Software / Service', :requires => ['software'], :allows => []},
|
|
519
539
|
}
|
|
520
540
|
end
|
|
521
541
|
|
|
542
|
+
def get_price_set_type_code(value)
|
|
543
|
+
rtn = value
|
|
544
|
+
price_set_types.each do |k,v|
|
|
545
|
+
if value.to_s.downcase == v[:label].downcase
|
|
546
|
+
rtn = k
|
|
547
|
+
end
|
|
548
|
+
end
|
|
549
|
+
return rtn
|
|
550
|
+
end
|
|
551
|
+
|
|
522
552
|
def format_amount(amount)
|
|
523
553
|
rtn = amount.to_s
|
|
524
554
|
if rtn.index('.').nil?
|
|
@@ -16,6 +16,7 @@ class Morpheus::Cli::PricesCommand
|
|
|
16
16
|
@api_client = establish_remote_appliance_connection(opts)
|
|
17
17
|
@prices_interface = @api_client.prices
|
|
18
18
|
@accounts_interface = @api_client.accounts
|
|
19
|
+
@options_interface = @api_client.options
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
def handle(args)
|
|
@@ -39,8 +40,8 @@ class Morpheus::Cli::PricesCommand
|
|
|
39
40
|
opts.on('--currency CURRENCY', Array, "Filter by currency eg. usd") do |val|
|
|
40
41
|
params['currency'] = val.collect {|it| it.to_s.strip.empty? ? nil : it.to_s.strip }.compact
|
|
41
42
|
end
|
|
42
|
-
opts.on('--price-type TYPE',
|
|
43
|
-
params
|
|
43
|
+
opts.on('--price-type TYPE', String, "Filter by priceType eg. fixed,platform,software,compute,storage,datastore,memory,cores,cpu") do |val|
|
|
44
|
+
add_query_parameter(params, 'priceType', parse_array(val).collect {|it| get_price_type_code(it) })
|
|
44
45
|
end
|
|
45
46
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
|
46
47
|
opts.footer = "List prices."
|
|
@@ -65,7 +66,7 @@ class Morpheus::Cli::PricesCommand
|
|
|
65
66
|
subtitles += parse_list_subtitles(options)
|
|
66
67
|
print_h1 title, subtitles
|
|
67
68
|
if prices.empty?
|
|
68
|
-
print
|
|
69
|
+
print cyan,"No prices found.",reset,"\n"
|
|
69
70
|
else
|
|
70
71
|
rows = prices.collect do |it|
|
|
71
72
|
{
|
|
@@ -91,7 +92,6 @@ class Morpheus::Cli::PricesCommand
|
|
|
91
92
|
end
|
|
92
93
|
print reset,"\n"
|
|
93
94
|
end
|
|
94
|
-
return 1, "0 prices found" if prices.empty?
|
|
95
95
|
return 0, nil
|
|
96
96
|
end
|
|
97
97
|
|
|
@@ -600,10 +600,22 @@ class Morpheus::Cli::PricesCommand
|
|
|
600
600
|
'storage' => 'Disk Only',
|
|
601
601
|
'datastore' => 'Datastore',
|
|
602
602
|
'platform' => 'Platform',
|
|
603
|
-
'software' => 'Software'
|
|
603
|
+
'software' => 'Software',
|
|
604
|
+
'load_balancer' => 'Load Balancer',
|
|
605
|
+
'load_balancer_virtual_server' => 'Load Balancer Virtual Server',
|
|
604
606
|
}
|
|
605
607
|
end
|
|
606
608
|
|
|
609
|
+
def get_price_type_code(value)
|
|
610
|
+
rtn = value
|
|
611
|
+
price_types.each do |k,v|
|
|
612
|
+
if value.to_s.downcase == v.downcase
|
|
613
|
+
rtn = k
|
|
614
|
+
end
|
|
615
|
+
end
|
|
616
|
+
return rtn
|
|
617
|
+
end
|
|
618
|
+
|
|
607
619
|
def price_units
|
|
608
620
|
['minute', 'hour', 'day', 'month', 'year', 'two year', 'three year', 'four year', 'five year']
|
|
609
621
|
end
|
|
@@ -302,6 +302,7 @@ class Morpheus::Cli::Processes
|
|
|
302
302
|
history_records = []
|
|
303
303
|
if process_events.empty?
|
|
304
304
|
puts "#{cyan}No events found.#{reset}"
|
|
305
|
+
print reset,"\n"
|
|
305
306
|
else
|
|
306
307
|
process_events.each do |process_event|
|
|
307
308
|
event_row = {
|
|
@@ -336,8 +337,8 @@ class Morpheus::Cli::Processes
|
|
|
336
337
|
print as_pretty_table(history_records, columns, options)
|
|
337
338
|
print_results_pagination({size: process_events.size, total: process_events.size})
|
|
338
339
|
print reset, "\n"
|
|
339
|
-
return 0
|
|
340
340
|
end
|
|
341
|
+
return 0, nil
|
|
341
342
|
end
|
|
342
343
|
rescue RestClient::Exception => e
|
|
343
344
|
print_rest_exception(e, options)
|
|
@@ -797,19 +797,16 @@ EOT
|
|
|
797
797
|
if use_it
|
|
798
798
|
appliance[:active] = true
|
|
799
799
|
end
|
|
800
|
-
|
|
801
800
|
# save the new remote
|
|
802
|
-
::Morpheus::Cli::Remote.save_remote(
|
|
801
|
+
appliance = ::Morpheus::Cli::Remote.save_remote(new_appliance_name, appliance)
|
|
803
802
|
# refresh it now?
|
|
804
803
|
appliance, json_response = ::Morpheus::Cli::Remote.refresh_remote(new_appliance_name)
|
|
805
|
-
|
|
806
804
|
# render
|
|
807
|
-
if options[:quiet]
|
|
808
|
-
|
|
805
|
+
if !options[:quiet]
|
|
806
|
+
print_green_success "Cloned remote #{original_appliance[:name]} to #{appliance[:name]}, status is #{format_appliance_status(appliance)}"
|
|
807
|
+
# print new appliance details
|
|
808
|
+
_get(appliance[:name].to_s, {})
|
|
809
809
|
end
|
|
810
|
-
print_green_success "Cloned remote #{original_appliance[:name]} to #{appliance[:name]}"
|
|
811
|
-
# print new appliance details
|
|
812
|
-
_get(appliance[:name], {})
|
|
813
810
|
return exit_code, err
|
|
814
811
|
end
|
|
815
812
|
|
|
@@ -1255,9 +1252,9 @@ EOT
|
|
|
1255
1252
|
return Morpheus::Cli::Setup.new.handle(cmd_args)
|
|
1256
1253
|
end
|
|
1257
1254
|
|
|
1258
|
-
def load_remote_by_name(appliance_name
|
|
1255
|
+
def load_remote_by_name(appliance_name)
|
|
1259
1256
|
appliance = nil
|
|
1260
|
-
if appliance_name.to_s == "current"
|
|
1257
|
+
if appliance_name.to_s == "current"
|
|
1261
1258
|
appliance = ::Morpheus::Cli::Remote.load_active_remote()
|
|
1262
1259
|
if !appliance
|
|
1263
1260
|
raise_command_error "No current appliance, see the command `remote use`"
|