morpheus-cli 5.3.2.2 → 5.4.0
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 +26 -1
- data/lib/morpheus/api/clouds_interface.rb +4 -11
- data/lib/morpheus/api/health_interface.rb +37 -3
- data/lib/morpheus/api/instances_interface.rb +18 -5
- data/lib/morpheus/api/load_balancer_pools_interface.rb +4 -4
- data/lib/morpheus/api/load_balancer_profiles_interface.rb +10 -0
- data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +4 -4
- data/lib/morpheus/api/network_dhcp_relays_interface.rb +36 -0
- data/lib/morpheus/api/network_dhcp_servers_interface.rb +36 -0
- data/lib/morpheus/api/network_edge_clusters_interface.rb +26 -0
- data/lib/morpheus/api/network_routers_interface.rb +21 -0
- data/lib/morpheus/api/network_servers_interface.rb +98 -0
- data/lib/morpheus/api/rest_interface.rb +2 -1
- data/lib/morpheus/api/roles_interface.rb +7 -0
- data/lib/morpheus/api/virtual_images_interface.rb +23 -2
- data/lib/morpheus/api/virtual_servers_interface.rb +9 -0
- data/lib/morpheus/cli/cli_command.rb +21 -14
- data/lib/morpheus/cli/cli_registry.rb +56 -2
- data/lib/morpheus/cli/{access_token_command.rb → commands/access_token_command.rb} +1 -1
- data/lib/morpheus/cli/{account_groups_command.rb → commands/account_groups_command.rb} +0 -8
- data/lib/morpheus/cli/{activity_command.rb → commands/activity_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/alias_command.rb → alias_command.rb} +0 -3
- data/lib/morpheus/cli/{appliance_settings_command.rb → commands/appliance_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{approvals_command.rb → commands/approvals_command.rb} +0 -0
- data/lib/morpheus/cli/{apps.rb → commands/apps.rb} +3 -11
- data/lib/morpheus/cli/{archives_command.rb → commands/archives_command.rb} +0 -6
- data/lib/morpheus/cli/{backup_jobs_command.rb → commands/backup_jobs_command.rb} +0 -0
- data/lib/morpheus/cli/{backup_settings_command.rb → commands/backup_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{backups_command.rb → commands/backups_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/benchmark_command.rb → benchmark_command.rb} +0 -3
- data/lib/morpheus/cli/{blueprints_command.rb → commands/blueprints_command.rb} +0 -0
- data/lib/morpheus/cli/{boot_scripts_command.rb → commands/boot_scripts_command.rb} +0 -3
- data/lib/morpheus/cli/{budgets_command.rb → commands/budgets_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/cat_command.rb → cat_command.rb} +0 -0
- data/lib/morpheus/cli/{catalog_item_types_command.rb → commands/catalog_item_types_command.rb} +0 -0
- data/lib/morpheus/cli/{certificates_command.rb → commands/certificates_command.rb} +0 -0
- data/lib/morpheus/cli/commands/change_password_command.rb +132 -0
- data/lib/morpheus/cli/{cloud_datastores_command.rb → commands/cloud_datastores_command.rb} +0 -4
- data/lib/morpheus/cli/{cloud_folders_command.rb → commands/cloud_folders_command.rb} +0 -4
- data/lib/morpheus/cli/{cloud_resource_pools_command.rb → commands/cloud_resource_pools_command.rb} +170 -138
- data/lib/morpheus/cli/{clouds.rb → commands/clouds.rb} +22 -47
- data/lib/morpheus/cli/{clusters.rb → commands/clusters.rb} +51 -39
- data/lib/morpheus/cli/commands/{standard/coloring_command.rb → coloring_command.rb} +0 -2
- data/lib/morpheus/cli/{containers_command.rb → commands/containers_command.rb} +0 -7
- data/lib/morpheus/cli/commands/{standard/curl_command.rb → curl_command.rb} +0 -3
- data/lib/morpheus/cli/{cypher_command.rb → commands/cypher_command.rb} +0 -1
- data/lib/morpheus/cli/{dashboard_command.rb → commands/dashboard_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/debug_command.rb → debug_command.rb} +0 -1
- data/lib/morpheus/cli/{deploy.rb → commands/deploy.rb} +0 -1
- data/lib/morpheus/cli/{deployments.rb → commands/deployments.rb} +0 -0
- data/lib/morpheus/cli/{deploys.rb → commands/deploys.rb} +0 -1
- data/lib/morpheus/cli/{doc.rb → commands/doc.rb} +1 -1
- data/lib/morpheus/cli/commands/{standard/echo_command.rb → echo_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/edit_profile_command.rb → edit_profile_command.rb} +15 -4
- data/lib/morpheus/cli/commands/{standard/edit_rc_command.rb → edit_rc_command.rb} +19 -3
- data/lib/morpheus/cli/{environments_command.rb → commands/environments_command.rb} +0 -5
- data/lib/morpheus/cli/{execute_schedules_command.rb → commands/execute_schedules_command.rb} +0 -0
- data/lib/morpheus/cli/{execution_request_command.rb → commands/execution_request_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/exit_command.rb → exit_command.rb} +0 -2
- data/lib/morpheus/cli/{file_copy_request_command.rb → commands/file_copy_request_command.rb} +0 -4
- data/lib/morpheus/cli/{forgot_password.rb → commands/forgot_password.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/get_prompt_command.rb → get_prompt_command.rb} +0 -3
- data/lib/morpheus/cli/{groups.rb → commands/groups.rb} +0 -7
- data/lib/morpheus/cli/{guidance_command.rb → commands/guidance_command.rb} +1 -1
- data/lib/morpheus/cli/{health_command.rb → commands/health_command.rb} +104 -19
- data/lib/morpheus/cli/commands/{standard/history_command.rb → history_command.rb} +0 -3
- data/lib/morpheus/cli/{hosts.rb → commands/hosts.rb} +0 -10
- data/lib/morpheus/cli/{image_builder_command.rb → commands/image_builder_command.rb} +2 -8
- data/lib/morpheus/cli/{instance_types.rb → commands/instance_types.rb} +0 -3
- data/lib/morpheus/cli/{instances.rb → commands/instances.rb} +364 -148
- data/lib/morpheus/cli/{integrations_command.rb → commands/integrations_command.rb} +0 -0
- data/lib/morpheus/cli/{invoices_command.rb → commands/invoices_command.rb} +118 -134
- data/lib/morpheus/cli/{jobs_command.rb → commands/jobs_command.rb} +0 -0
- data/lib/morpheus/cli/{key_pairs.rb → commands/key_pairs.rb} +0 -6
- data/lib/morpheus/cli/{library_cluster_layouts_command.rb → commands/library_cluster_layouts_command.rb} +20 -4
- data/lib/morpheus/cli/{library_container_scripts_command.rb → commands/library_container_scripts_command.rb} +0 -0
- data/lib/morpheus/cli/{library_container_templates_command.rb → commands/library_container_templates_command.rb} +0 -1
- data/lib/morpheus/cli/{library_container_types_command.rb → commands/library_container_types_command.rb} +0 -4
- data/lib/morpheus/cli/{library_instance_types_command.rb → commands/library_instance_types_command.rb} +0 -4
- data/lib/morpheus/cli/{library_layouts_command.rb → commands/library_layouts_command.rb} +0 -4
- data/lib/morpheus/cli/{library_option_lists_command.rb → commands/library_option_lists_command.rb} +3 -7
- data/lib/morpheus/cli/{library_option_types_command.rb → commands/library_option_types_command.rb} +0 -4
- data/lib/morpheus/cli/{library_spec_templates_command.rb → commands/library_spec_templates_command.rb} +0 -1
- data/lib/morpheus/cli/{library_upgrades_command.rb → commands/library_upgrades_command.rb} +0 -4
- data/lib/morpheus/cli/{license.rb → commands/license.rb} +0 -3
- data/lib/morpheus/cli/commands/load_balancer_pools.rb +111 -0
- data/lib/morpheus/cli/{load_balancer_types.rb → commands/load_balancer_types.rb} +0 -4
- data/lib/morpheus/cli/commands/load_balancer_virtual_servers.rb +136 -0
- data/lib/morpheus/cli/commands/load_balancers.rb +89 -0
- data/lib/morpheus/cli/commands/{standard/log_level_command.rb → log_level_command.rb} +0 -3
- data/lib/morpheus/cli/{log_settings_command.rb → commands/log_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{login.rb → commands/login.rb} +0 -5
- data/lib/morpheus/cli/commands/logout.rb +63 -0
- data/lib/morpheus/cli/{logs_command.rb → commands/logs_command.rb} +0 -3
- data/lib/morpheus/cli/commands/{standard/man_command.rb → man_command.rb} +0 -2
- data/lib/morpheus/cli/{monitoring_alerts_command.rb → commands/monitoring_alerts_command.rb} +0 -7
- data/lib/morpheus/cli/{monitoring_apps_command.rb → commands/monitoring_apps_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_checks_command.rb → commands/monitoring_checks_command.rb} +2 -1
- data/lib/morpheus/cli/{monitoring_contacts_command.rb → commands/monitoring_contacts_command.rb} +0 -7
- data/lib/morpheus/cli/{monitoring_groups_command.rb → commands/monitoring_groups_command.rb} +0 -1
- data/lib/morpheus/cli/{monitoring_incidents_command.rb → commands/monitoring_incidents_command.rb} +0 -1
- data/lib/morpheus/cli/commands/network_dhcp_relays_command.rb +416 -0
- data/lib/morpheus/cli/commands/network_dhcp_servers_command.rb +407 -0
- data/lib/morpheus/cli/{network_domains_command.rb → commands/network_domains_command.rb} +0 -4
- data/lib/morpheus/cli/commands/network_edge_clusters_command.rb +329 -0
- data/lib/morpheus/cli/commands/network_firewalls_command.rb +806 -0
- data/lib/morpheus/cli/{network_groups_command.rb → commands/network_groups_command.rb} +0 -4
- data/lib/morpheus/cli/{network_pool_servers_command.rb → commands/network_pool_servers_command.rb} +0 -4
- data/lib/morpheus/cli/{network_pools_command.rb → commands/network_pools_command.rb} +0 -4
- data/lib/morpheus/cli/{network_proxies_command.rb → commands/network_proxies_command.rb} +0 -4
- data/lib/morpheus/cli/{network_routers_command.rb → commands/network_routers_command.rb} +291 -12
- data/lib/morpheus/cli/{network_services_command.rb → commands/network_services_command.rb} +0 -4
- data/lib/morpheus/cli/commands/network_transport_zones_command.rb +452 -0
- data/lib/morpheus/cli/{networks_command.rb → commands/networks_command.rb} +21 -21
- data/lib/morpheus/cli/{packages_command.rb → commands/packages_command.rb} +0 -2
- data/lib/morpheus/cli/{ping.rb → commands/ping.rb} +0 -7
- data/lib/morpheus/cli/{policies_command.rb → commands/policies_command.rb} +0 -7
- data/lib/morpheus/cli/{power_schedules_command.rb → commands/power_schedules_command.rb} +0 -0
- data/lib/morpheus/cli/{preseed_scripts_command.rb → commands/preseed_scripts_command.rb} +0 -3
- data/lib/morpheus/cli/{price_sets_command.rb → commands/price_sets_command.rb} +0 -0
- data/lib/morpheus/cli/{prices_command.rb → commands/prices_command.rb} +0 -0
- data/lib/morpheus/cli/{processes_command.rb → commands/processes_command.rb} +0 -1
- data/lib/morpheus/cli/{projects_command.rb → commands/projects_command.rb} +0 -0
- data/lib/morpheus/cli/{provisioning_licenses_command.rb → commands/provisioning_licenses_command.rb} +0 -0
- data/lib/morpheus/cli/{provisioning_settings_command.rb → commands/provisioning_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{recent_activity_command.rb → commands/recent_activity_command.rb} +0 -0
- data/lib/morpheus/cli/{remote.rb → commands/remote.rb} +1 -7
- data/lib/morpheus/cli/{reports_command.rb → commands/reports_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/rm_command.rb → rm_command.rb} +0 -0
- data/lib/morpheus/cli/{roles.rb → commands/roles.rb} +244 -39
- data/lib/morpheus/cli/{search_command.rb → commands/search_command.rb} +0 -0
- data/lib/morpheus/cli/{security_group_rules.rb → commands/security_group_rules.rb} +0 -5
- data/lib/morpheus/cli/{security_groups.rb → commands/security_groups.rb} +0 -6
- data/lib/morpheus/cli/{service_catalog_command.rb → commands/service_catalog_command.rb} +0 -0
- data/lib/morpheus/cli/{service_plans_command.rb → commands/service_plans_command.rb} +0 -0
- data/lib/morpheus/cli/commands/{standard/set_prompt_command.rb → set_prompt_command.rb} +0 -3
- data/lib/morpheus/cli/{setup.rb → commands/setup.rb} +0 -0
- data/lib/morpheus/cli/{shell.rb → commands/shell.rb} +2 -103
- data/lib/morpheus/cli/commands/{standard/sleep_command.rb → sleep_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/source_command.rb → source_command.rb} +0 -2
- data/lib/morpheus/cli/commands/{standard/ssl_verification_command.rb → ssl_verification_command.rb} +0 -3
- data/lib/morpheus/cli/{storage_providers_command.rb → commands/storage_providers_command.rb} +0 -4
- data/lib/morpheus/cli/{subnets_command.rb → commands/subnets_command.rb} +7 -6
- data/lib/morpheus/cli/{tasks.rb → commands/tasks.rb} +25 -6
- data/lib/morpheus/cli/commands/{standard/tee_command.rb → tee_command.rb} +0 -0
- data/lib/morpheus/cli/{tenants_command.rb → commands/tenants_command.rb} +0 -7
- data/lib/morpheus/cli/commands/{standard/update_command.rb → update_command.rb} +0 -1
- data/lib/morpheus/cli/{usage_command.rb → commands/usage_command.rb} +0 -0
- data/lib/morpheus/cli/{user_groups_command.rb → commands/user_groups_command.rb} +0 -1
- data/lib/morpheus/cli/{user_settings_command.rb → commands/user_settings_command.rb} +0 -0
- data/lib/morpheus/cli/{user_sources_command.rb → commands/user_sources_command.rb} +0 -1
- data/lib/morpheus/cli/{users.rb → commands/users.rb} +0 -7
- data/lib/morpheus/cli/{vdi_allocations_command.rb → commands/vdi_allocations_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_apps_command.rb → commands/vdi_apps_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_command.rb → commands/vdi_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_gateways_command.rb → commands/vdi_gateways_command.rb} +0 -0
- data/lib/morpheus/cli/{vdi_pools_command.rb → commands/vdi_pools_command.rb} +4 -1
- data/lib/morpheus/cli/commands/{standard/version_command.rb → version_command.rb} +0 -0
- data/lib/morpheus/cli/{virtual_images.rb → commands/virtual_images.rb} +251 -33
- data/lib/morpheus/cli/{whitelabel_settings_command.rb → commands/whitelabel_settings_command.rb} +0 -1
- data/lib/morpheus/cli/{whoami.rb → commands/whoami.rb} +0 -4
- data/lib/morpheus/cli/{wiki_command.rb → commands/wiki_command.rb} +0 -5
- data/lib/morpheus/cli/{workflows.rb → commands/workflows.rb} +0 -3
- data/lib/morpheus/cli/mixins/load_balancers_helper.rb +2 -2
- data/lib/morpheus/cli/mixins/logs_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/print_helper.rb +1 -0
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +155 -112
- data/lib/morpheus/cli/mixins/rest_command.rb +154 -52
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +575 -0
- data/lib/morpheus/cli/option_parser.rb +25 -17
- data/lib/morpheus/cli/option_types.rb +96 -32
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +5 -128
- data/lib/morpheus/terminal.rb +5 -6
- data/morpheus-cli.gemspec +1 -1
- metadata +156 -143
- data/lib/morpheus/cli/change_password_command.rb +0 -147
- data/lib/morpheus/cli/library.rb +0 -1
- data/lib/morpheus/cli/load_balancers.rb +0 -245
- data/lib/morpheus/cli/logout.rb +0 -81
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
2
|
|
|
7
3
|
class Morpheus::Cli::Tasks
|
|
@@ -198,7 +194,14 @@ class Morpheus::Cli::Tasks
|
|
|
198
194
|
end
|
|
199
195
|
else
|
|
200
196
|
task_option_types << optionType
|
|
201
|
-
task_option_columns << {(optionType['fieldLabel']) => lambda {|it|
|
|
197
|
+
task_option_columns << {(optionType['fieldLabel']) => lambda {|it|
|
|
198
|
+
value = task['taskOptions'][optionType['code']] || task['taskOptions'][optionType['fieldName']] || optionType['defaultValue']
|
|
199
|
+
if optionType['type'] == 'checkbox'
|
|
200
|
+
value.to_s.empty? ? 'off' : value.to_s
|
|
201
|
+
else
|
|
202
|
+
value.to_s
|
|
203
|
+
end
|
|
204
|
+
} }
|
|
202
205
|
end
|
|
203
206
|
end
|
|
204
207
|
else
|
|
@@ -430,6 +433,10 @@ class Morpheus::Cli::Tasks
|
|
|
430
433
|
if it['fieldContext'].nil? || it['fieldContext'] == ''
|
|
431
434
|
it['fieldContext'] = 'taskOptions'
|
|
432
435
|
end
|
|
436
|
+
# taskOptions should prompt for code instead of fieldName, oy vey
|
|
437
|
+
if it['fieldContext'] == 'taskOptions'
|
|
438
|
+
it['fieldName'] = it['code']
|
|
439
|
+
end
|
|
433
440
|
end
|
|
434
441
|
end
|
|
435
442
|
# inject file_params into options for file-content prompt
|
|
@@ -444,8 +451,20 @@ class Morpheus::Cli::Tasks
|
|
|
444
451
|
end
|
|
445
452
|
end
|
|
446
453
|
# prompt
|
|
454
|
+
|
|
455
|
+
# tasks are different in that they use the optionType code instead of fieldName for the key values
|
|
447
456
|
input_options = Morpheus::Cli::OptionTypes.prompt(task_option_types, options[:options],@api_client, options[:params])
|
|
448
|
-
|
|
457
|
+
# flatten taskOptions as serverside expects
|
|
458
|
+
if input_options['taskOptions']
|
|
459
|
+
input_options['taskOptions'] = Morpheus::RestClient.grails_params(input_options['taskOptions'])
|
|
460
|
+
# remove "off" checkbox values, like the UI does
|
|
461
|
+
input_options['taskOptions'].keys.each do |k|
|
|
462
|
+
if input_options['taskOptions'][k] == "off"
|
|
463
|
+
input_options['taskOptions'].delete(k)
|
|
464
|
+
end
|
|
465
|
+
end
|
|
466
|
+
end
|
|
467
|
+
payload.deep_merge!({'task' => input_options}) unless input_options.empty?
|
|
449
468
|
|
|
450
469
|
|
|
451
470
|
# Target Options
|
|
File without changes
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
|
-
require 'morpheus/cli/option_types'
|
|
7
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
8
|
-
require 'json'
|
|
9
2
|
|
|
10
3
|
class Morpheus::Cli::TenantsCommand
|
|
11
4
|
include Morpheus::Cli::CliCommand
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
|
-
require 'morpheus/cli/option_types'
|
|
7
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
8
|
-
require 'json'
|
|
9
2
|
|
|
10
3
|
class Morpheus::Cli::Users
|
|
11
4
|
include Morpheus::Cli::CliCommand
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -418,6 +418,7 @@ EOT
|
|
|
418
418
|
"Name" => 'name',
|
|
419
419
|
"Description" => 'description',
|
|
420
420
|
"Persistent" => lambda {|it| format_boolean(it['persistentUser']) },
|
|
421
|
+
"Recyclable" => lambda {|it| it['recyclable'].nil? ? nil : format_boolean(it['recyclable']) },
|
|
421
422
|
"Enabled" => lambda {|it| format_boolean(it['enabled']) },
|
|
422
423
|
"Pool Usage" => lambda {|it|
|
|
423
424
|
# todo: [== ] 2/8 would be neat generate_usage_bar(...)
|
|
@@ -447,12 +448,13 @@ EOT
|
|
|
447
448
|
"Max Size" => lambda {|it| format_number(it['maxPoolSize']) rescue '' },
|
|
448
449
|
"Lease Timeout" => lambda {|it| format_number(it['allocationTimeoutMinutes']) rescue '' },
|
|
449
450
|
"Persistent" => lambda {|it| format_boolean(it['persistentUser']) },
|
|
451
|
+
"Recyclable" => lambda {|it| it['recyclable'].nil? ? nil : format_boolean(it['recyclable']) },
|
|
452
|
+
"Enabled" => lambda {|it| format_boolean(it['enabled']) },
|
|
450
453
|
"Allow Copy" => lambda {|it| format_boolean(it['allowCopy']) },
|
|
451
454
|
"Allow Printer" => lambda {|it| format_boolean(it['allowPrinter']) },
|
|
452
455
|
"Allow File Share" => lambda {|it| format_boolean(it['allowFileshare']) },
|
|
453
456
|
"Allow Hypervisor Console" => lambda {|it| format_boolean(it['allowHypervisorConsole']) },
|
|
454
457
|
"Auto Create User" => lambda {|it| format_boolean(it['autoCreateLocalUserOnReservation']) },
|
|
455
|
-
"Enabled" => lambda {|it| format_boolean(it['enabled']) },
|
|
456
458
|
"Logo" => lambda {|it| it['logo'] || it['imagePath'] },
|
|
457
459
|
#"Config" => lambda {|it| it['config'] },
|
|
458
460
|
"Group" => lambda {|it| it['group'] ? it['group']['name'] : nil },
|
|
@@ -484,6 +486,7 @@ EOT
|
|
|
484
486
|
{'fieldName' => 'maxPoolSize', 'fieldLabel' => 'Max Size', 'type' => 'number', 'required' => true, 'description' => 'Max limit on number of allocations and instances within the pool.'},
|
|
485
487
|
{'fieldName' => 'allocationTimeoutMinutes', 'fieldLabel' => 'Lease Timeout', 'type' => 'number', 'description' => 'Time (in minutes) after a user disconnects before an allocation is recycled or shutdown depending on persistence.'},
|
|
486
488
|
{'fieldName' => 'persistentUser', 'fieldLabel' => 'Persistent', 'type' => 'checkbox', 'defaultValue' => false},
|
|
489
|
+
{'fieldName' => 'recyclable', 'fieldLabel' => 'Recyclable', 'type' => 'checkbox', 'defaultValue' => false, 'description' => 'Recyclable VDI Pools only work with cloud types that support snapshot management (i.e. Vmware, Nutanix, VCD)'},
|
|
487
490
|
{'fieldName' => 'allowCopy', 'fieldLabel' => 'Allow Copy', 'type' => 'checkbox', 'defaultValue' => false},
|
|
488
491
|
{'fieldName' => 'allowPrinter', 'fieldLabel' => 'Allow Printer', 'type' => 'checkbox', 'defaultValue' => false},
|
|
489
492
|
{'fieldName' => 'allowFileshare', 'fieldLabel' => 'Allow File Share', 'type' => 'checkbox', 'defaultValue' => false},
|
|
File without changes
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
2
|
|
|
7
3
|
# JD: I don't think a lot of this has ever worked, fix it up.
|
|
@@ -11,8 +7,7 @@ class Morpheus::Cli::VirtualImages
|
|
|
11
7
|
include Morpheus::Cli::ProvisioningHelper
|
|
12
8
|
|
|
13
9
|
register_subcommands :list, :get, :add, :add_file, :remove_file, :update, :remove, :types => :virtual_image_types
|
|
14
|
-
|
|
15
|
-
set_default_subcommand :list
|
|
10
|
+
register_subcommands :list_locations, :get_location, :remove_location
|
|
16
11
|
|
|
17
12
|
# def initialize()
|
|
18
13
|
# # @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
|
|
@@ -84,6 +79,7 @@ class Morpheus::Cli::VirtualImages
|
|
|
84
79
|
json_response = @virtual_images_interface.list(params)
|
|
85
80
|
images = json_response['virtualImages']
|
|
86
81
|
render_response(json_response, options, 'virtualImages') do
|
|
82
|
+
get_available_virtual_image_types() # preload
|
|
87
83
|
title = "Morpheus Virtual Images"
|
|
88
84
|
subtitles = parse_list_subtitles(options)
|
|
89
85
|
if options[:imageType]
|
|
@@ -188,10 +184,12 @@ EOT
|
|
|
188
184
|
image = json_response['virtualImage']
|
|
189
185
|
image_config = image['config'] || {}
|
|
190
186
|
image_volumes = image['volumes'] || []
|
|
187
|
+
image_locations = image['locations'] || []
|
|
191
188
|
image_files = json_response['cloudFiles'] || json_response['files']
|
|
192
189
|
image_type = virtual_image_type_for_name_or_code(image['imageType'])
|
|
193
190
|
image_type_display = image_type ? "#{image_type['name']}" : image['imageType']
|
|
194
191
|
render_response(json_response, options, 'virtualImage') do
|
|
192
|
+
get_available_virtual_image_types() # preload
|
|
195
193
|
print_h1 "Virtual Image Details", [], options
|
|
196
194
|
description_cols = {
|
|
197
195
|
"ID" => 'id',
|
|
@@ -255,7 +253,7 @@ EOT
|
|
|
255
253
|
# print "\n", reset
|
|
256
254
|
end
|
|
257
255
|
|
|
258
|
-
if image_files
|
|
256
|
+
if image_files && !image_files.empty?
|
|
259
257
|
print_h2 "Files (#{image_files.size})"
|
|
260
258
|
# image_files.each {|image_file|
|
|
261
259
|
# pretty_filesize = Filesize.from("#{image_file['size']} B").pretty
|
|
@@ -270,6 +268,11 @@ EOT
|
|
|
270
268
|
print as_pretty_table(image_file_rows, [:filename, :size])
|
|
271
269
|
# print reset,"\n"
|
|
272
270
|
end
|
|
271
|
+
|
|
272
|
+
if image_locations && !image_locations.empty?
|
|
273
|
+
print_h2 "Locations", options
|
|
274
|
+
print as_pretty_table(image_locations, virtual_image_location_list_column_definitions.upcase_keys!, options)
|
|
275
|
+
end
|
|
273
276
|
|
|
274
277
|
if options[:details] && image_config && !image_config.empty?
|
|
275
278
|
print_h2 "Config", options
|
|
@@ -689,7 +692,7 @@ EOT
|
|
|
689
692
|
image = find_virtual_image_by_name_or_id(image_name)
|
|
690
693
|
return 1 if image.nil?
|
|
691
694
|
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the virtual image filename #{filename}?")
|
|
692
|
-
|
|
695
|
+
return 9, "aborted"
|
|
693
696
|
end
|
|
694
697
|
@virtual_images_interface.setopts(options)
|
|
695
698
|
if options[:dry_run]
|
|
@@ -709,44 +712,188 @@ EOT
|
|
|
709
712
|
end
|
|
710
713
|
|
|
711
714
|
def remove(args)
|
|
715
|
+
params = {}
|
|
712
716
|
options = {}
|
|
713
717
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
714
|
-
opts.banner = subcommand_usage("[
|
|
715
|
-
|
|
718
|
+
opts.banner = subcommand_usage("[image] [location]")
|
|
719
|
+
opts.on('--remove-from-cloud [true|false]', String, "Remove from all clouds. Default is true.") do |val|
|
|
720
|
+
options[:options]['removeFromCloud'] = ['','true','on'].include?(val.to_s)
|
|
721
|
+
end
|
|
722
|
+
build_standard_remove_options(opts, options)
|
|
723
|
+
opts.footer = <<-EOT
|
|
724
|
+
Delete a virtual image.
|
|
725
|
+
[image] is required. This is the name or id of a virtual image.
|
|
726
|
+
EOT
|
|
716
727
|
end
|
|
717
728
|
optparse.parse!(args)
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
729
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
|
730
|
+
connect(options)
|
|
731
|
+
image = find_virtual_image_by_name_or_id(args[0])
|
|
732
|
+
return 1, "virtual image not found for '#{args[0]}'" if image.nil?
|
|
733
|
+
params.merge!(parse_query_options(options))
|
|
734
|
+
# Delete prompt
|
|
735
|
+
# [ X ] Remove from all clouds
|
|
736
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'removeFromCloud', 'fieldLabel' => 'Remove from all clouds', 'type' => 'checkbox', 'defaultValue' => true, 'required' => true, 'description' => "Remove from all clouds"}], options[:options], @api_client)
|
|
737
|
+
remove_from_cloud = v_prompt['removeFromCloud'].to_s == 'true' || v_prompt['removeFromCloud'].to_s == 'on'
|
|
738
|
+
params['removeFromCloud'] = remove_from_cloud
|
|
739
|
+
|
|
740
|
+
# Delete confirmation
|
|
741
|
+
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the virtual image #{image['name']}?")
|
|
742
|
+
return 9, "aborted"
|
|
743
|
+
end
|
|
744
|
+
|
|
745
|
+
@virtual_images_interface.setopts(options)
|
|
746
|
+
if options[:dry_run]
|
|
747
|
+
print_dry_run @virtual_images_interface.dry.destroy(image['id'], params)
|
|
748
|
+
return
|
|
749
|
+
end
|
|
750
|
+
json_response = @virtual_images_interface.destroy(image['id'], params)
|
|
751
|
+
render_response(json_response, options) do
|
|
752
|
+
print_green_success "Removed virtual image #{image['name']}"
|
|
753
|
+
end
|
|
754
|
+
return 0, nil
|
|
755
|
+
end
|
|
756
|
+
|
|
757
|
+
def list_locations(args)
|
|
758
|
+
params = {}
|
|
759
|
+
options = {}
|
|
760
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
761
|
+
opts.banner = subcommand_usage("[image]")
|
|
762
|
+
build_standard_list_options(opts, options)
|
|
763
|
+
opts.footer = <<-EOT
|
|
764
|
+
List virtual image locations for a specific virtual image.
|
|
765
|
+
[image] is required. This is the name or id of a virtual image.
|
|
766
|
+
EOT
|
|
767
|
+
end
|
|
768
|
+
optparse.parse!(args)
|
|
769
|
+
verify_args!(args:args, optparse:optparse, min:1)
|
|
770
|
+
if args.count > 1
|
|
771
|
+
options[:phrase] = args[1..-1].join(" ")
|
|
721
772
|
end
|
|
722
|
-
image_name = args[0]
|
|
723
773
|
connect(options)
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
774
|
+
image = find_virtual_image_by_name_or_id(args[0])
|
|
775
|
+
return 1, "virtual image not found for '#{args[0]}'" if image.nil?
|
|
776
|
+
params.merge!(parse_list_options(options))
|
|
777
|
+
@virtual_images_interface.setopts(options)
|
|
778
|
+
if options[:dry_run]
|
|
779
|
+
print_dry_run @virtual_images_interface.dry.list_locations(image['id'], params)
|
|
780
|
+
return
|
|
781
|
+
end
|
|
782
|
+
json_response = @virtual_images_interface.list_locations(image['id'], params)
|
|
783
|
+
records = json_response['locations']
|
|
784
|
+
render_response(json_response, options, 'virtualImages') do
|
|
785
|
+
title = "Virtual Image Locations"
|
|
786
|
+
subtitles = parse_list_subtitles(options)
|
|
787
|
+
print_h1 title, subtitles
|
|
788
|
+
if records.empty?
|
|
789
|
+
print cyan,"No virtual image locations found.",reset,"\n"
|
|
738
790
|
else
|
|
739
|
-
print
|
|
791
|
+
print as_pretty_table(records, virtual_image_location_list_column_definitions.upcase_keys!, options)
|
|
792
|
+
print_results_pagination(json_response)
|
|
740
793
|
end
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
794
|
+
print reset,"\n"
|
|
795
|
+
end
|
|
796
|
+
return 0, nil
|
|
797
|
+
end
|
|
798
|
+
|
|
799
|
+
def get_location(args)
|
|
800
|
+
params = {}
|
|
801
|
+
options = {}
|
|
802
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
803
|
+
opts.banner = subcommand_usage("[image] [location]")
|
|
804
|
+
build_standard_remove_options(opts, options)
|
|
805
|
+
opts.footer = <<-EOT
|
|
806
|
+
Get details about a virtual image location.
|
|
807
|
+
[image] is required. This is the name or id of a virtual image.
|
|
808
|
+
[location] is required. This is the name or id of a virtual image location.
|
|
809
|
+
EOT
|
|
744
810
|
end
|
|
811
|
+
optparse.parse!(args)
|
|
812
|
+
verify_args!(args:args, optparse:optparse, count:2)
|
|
813
|
+
connect(options)
|
|
814
|
+
image = find_virtual_image_by_name_or_id(args[0])
|
|
815
|
+
return 1, "virtual image not found for '#{args[0]}'" if image.nil?
|
|
816
|
+
location = find_virtual_image_location_by_name_or_id(image['id'], args[1])
|
|
817
|
+
return 1, "location not found for '#{args[1]}'" if location.nil?
|
|
818
|
+
params.merge!(parse_query_options(options))
|
|
819
|
+
@virtual_images_interface.setopts(options)
|
|
820
|
+
if options[:dry_run]
|
|
821
|
+
print_dry_run @virtual_images_interface.dry.get_location(image['id'], location['id'])
|
|
822
|
+
return 0, nil
|
|
823
|
+
end
|
|
824
|
+
# json_response = @virtual_images_interface.get(image['id'], location['id'])
|
|
825
|
+
json_response = {'location' => location} # skip redundant request
|
|
826
|
+
render_response(json_response, options, 'location') do
|
|
827
|
+
location = json_response['location']
|
|
828
|
+
volumes = location['volumes'] || []
|
|
829
|
+
print_h1 "Virtual Image Location Details", [], options
|
|
830
|
+
print_description_list(virtual_image_location_column_definitions, location, options)
|
|
831
|
+
if volumes && !volumes.empty?
|
|
832
|
+
print_h2 "Volumes", options
|
|
833
|
+
volume_rows = location_volumes.collect do |volume|
|
|
834
|
+
{name: volume['name'], size: Filesize.from("#{volume['rawSize']} B").pretty}
|
|
835
|
+
end
|
|
836
|
+
print cyan
|
|
837
|
+
print as_pretty_table(volume_rows, [:name, :size], options)
|
|
838
|
+
print cyan
|
|
839
|
+
# print "\n", reset
|
|
840
|
+
end
|
|
841
|
+
print reset,"\n"
|
|
842
|
+
end
|
|
843
|
+
return 0, nil
|
|
745
844
|
end
|
|
746
845
|
|
|
846
|
+
def remove_location(args)
|
|
847
|
+
params = {}
|
|
848
|
+
options = {}
|
|
849
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
850
|
+
opts.banner = subcommand_usage("[image] [location]")
|
|
851
|
+
opts.on('--remove-from-cloud [true|false]', String, "Remove from cloud. Default is true.") do |val|
|
|
852
|
+
options[:options]['removeFromCloud'] = ['','true','on'].include?(val.to_s)
|
|
853
|
+
end
|
|
854
|
+
build_standard_remove_options(opts, options)
|
|
855
|
+
opts.footer = <<-EOT
|
|
856
|
+
Delete a virtual image location.
|
|
857
|
+
[image] is required. This is the name or id of a virtual image.
|
|
858
|
+
[location] is required. This is the name or id of a virtual image location.
|
|
859
|
+
EOT
|
|
860
|
+
end
|
|
861
|
+
optparse.parse!(args)
|
|
862
|
+
verify_args!(args:args, optparse:optparse, count:2)
|
|
863
|
+
connect(options)
|
|
864
|
+
image = find_virtual_image_by_name_or_id(args[0])
|
|
865
|
+
return 1, "virtual image not found for '#{args[0]}'" if image.nil?
|
|
866
|
+
location = find_virtual_image_location_by_name_or_id(image['id'], args[1])
|
|
867
|
+
return 1, "location not found for '#{args[1]}'" if location.nil?
|
|
868
|
+
|
|
869
|
+
params.merge!(parse_query_options(options))
|
|
870
|
+
|
|
871
|
+
# Delete prompt
|
|
872
|
+
# [ X ] Remove from cloud
|
|
873
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'removeFromCloud', 'fieldLabel' => 'Remove from cloud', 'type' => 'checkbox', 'defaultValue' => true, 'required' => true, 'description' => "Remove from cloud"}], options[:options], @api_client)
|
|
874
|
+
remove_from_cloud = v_prompt['removeFromCloud'].to_s == 'true' || v_prompt['removeFromCloud'].to_s == 'on'
|
|
875
|
+
params['removeFromCloud'] = remove_from_cloud
|
|
876
|
+
|
|
877
|
+
# Delete confirmation
|
|
878
|
+
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the virtual image location #{location['id']}?")
|
|
879
|
+
return 9, "aborted"
|
|
880
|
+
end
|
|
881
|
+
|
|
882
|
+
@virtual_images_interface.setopts(options)
|
|
883
|
+
if options[:dry_run]
|
|
884
|
+
print_dry_run @virtual_images_interface.dry.destroy_location(image['id'], location['id'], params)
|
|
885
|
+
return
|
|
886
|
+
end
|
|
887
|
+
json_response = @virtual_images_interface.destroy_location(image['id'], location['id'], params)
|
|
888
|
+
render_response(json_response, options) do
|
|
889
|
+
print_green_success "Removed virtual image location #{location['id']}"
|
|
890
|
+
end
|
|
891
|
+
return 0, nil
|
|
892
|
+
end
|
|
747
893
|
|
|
748
894
|
private
|
|
749
|
-
|
|
895
|
+
|
|
896
|
+
def find_virtual_image_by_name_or_id(val)
|
|
750
897
|
if val.to_s =~ /\A\d{1,}\Z/
|
|
751
898
|
return find_virtual_image_by_id(val)
|
|
752
899
|
else
|
|
@@ -911,4 +1058,75 @@ EOT
|
|
|
911
1058
|
out
|
|
912
1059
|
end
|
|
913
1060
|
|
|
1061
|
+
|
|
1062
|
+
## Virtual Image Locations
|
|
1063
|
+
|
|
1064
|
+
def virtual_image_location_object_key
|
|
1065
|
+
"location"
|
|
1066
|
+
end
|
|
1067
|
+
|
|
1068
|
+
def virtual_image_location_list_key
|
|
1069
|
+
"locations"
|
|
1070
|
+
end
|
|
1071
|
+
|
|
1072
|
+
def find_virtual_image_location_by_name_or_id(virtual_image_id, val)
|
|
1073
|
+
if val.to_s =~ /\A\d{1,}\Z/
|
|
1074
|
+
return find_virtual_image_location_by_id(virtual_image_id, val)
|
|
1075
|
+
else
|
|
1076
|
+
return find_virtual_image_location_by_name(virtual_image_id, val)
|
|
1077
|
+
end
|
|
1078
|
+
end
|
|
1079
|
+
|
|
1080
|
+
def virtual_image_location_list_column_definitions
|
|
1081
|
+
virtual_image_location_column_definitions
|
|
1082
|
+
end
|
|
1083
|
+
|
|
1084
|
+
def virtual_image_location_column_definitions
|
|
1085
|
+
{
|
|
1086
|
+
"ID" => 'id',
|
|
1087
|
+
"Name" => 'imageName',
|
|
1088
|
+
"Cloud" => lambda {|it| it['cloud']['name'] rescue '' },
|
|
1089
|
+
"Public" => lambda {|it| format_boolean(it['isPublic']) },
|
|
1090
|
+
"Region" => lambda {|it| it['imageRegion'] },
|
|
1091
|
+
"External ID" => lambda {|it| it['externalId'] },
|
|
1092
|
+
"Price Plan" => lambda {|it| it['pricePlan'] ? it['pricePlan']['name'] : nil },
|
|
1093
|
+
# "Virtual Image" => lambda {|it| it['virtualImage']['name'] rescue '' },
|
|
1094
|
+
# "Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
|
1095
|
+
# "Updated" => lambda {|it| format_local_dt(it['lastUpdated']) }
|
|
1096
|
+
}
|
|
1097
|
+
end
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
def find_virtual_image_location_by_id(virtual_image_id, id)
|
|
1101
|
+
begin
|
|
1102
|
+
json_response = @virtual_images_interface.get_location(virtual_image_id, id.to_i)
|
|
1103
|
+
return json_response[virtual_image_location_object_key]
|
|
1104
|
+
rescue RestClient::Exception => e
|
|
1105
|
+
if e.response && e.response.code == 404
|
|
1106
|
+
print_red_alert "Virtual Image Location not found by id '#{id}'"
|
|
1107
|
+
else
|
|
1108
|
+
raise e
|
|
1109
|
+
end
|
|
1110
|
+
end
|
|
1111
|
+
end
|
|
1112
|
+
|
|
1113
|
+
def find_virtual_image_location_by_name(virtual_image_id, name)
|
|
1114
|
+
json_response = @virtual_images_interface.list_locations(virtual_image_id, {imageName: name.to_s})
|
|
1115
|
+
virtual_image_locations = json_response[virtual_image_location_list_key]
|
|
1116
|
+
if virtual_image_locations.empty?
|
|
1117
|
+
print_red_alert "Virtual Image Location not found by name '#{name}'"
|
|
1118
|
+
return nil
|
|
1119
|
+
elsif virtual_image_locations.size > 1
|
|
1120
|
+
print_red_alert "#{virtual_image_locations.size} Virtual Image Locations found by name '#{name}'"
|
|
1121
|
+
print_error "\n"
|
|
1122
|
+
puts_error as_pretty_table(virtual_image_locations, {"ID" => 'id', "NAME" => 'imageName'}, {color:red})
|
|
1123
|
+
print_red_alert "Try using ID instead"
|
|
1124
|
+
print_error reset,"\n"
|
|
1125
|
+
return nil
|
|
1126
|
+
else
|
|
1127
|
+
return virtual_image_locations[0]
|
|
1128
|
+
end
|
|
1129
|
+
end
|
|
1130
|
+
|
|
1131
|
+
|
|
914
1132
|
end
|
|
@@ -34,7 +34,7 @@ module Morpheus::Cli::LoadBalancersHelper
|
|
|
34
34
|
'Load Balancer'
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
def
|
|
37
|
+
def load_balancer_label_plural
|
|
38
38
|
'Load Balancers'
|
|
39
39
|
end
|
|
40
40
|
|
|
@@ -50,7 +50,7 @@ module Morpheus::Cli::LoadBalancersHelper
|
|
|
50
50
|
'Load Balancer Type'
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
def
|
|
53
|
+
def load_balancer_type_label_plural
|
|
54
54
|
'Load Balancer Types'
|
|
55
55
|
end
|
|
56
56
|
|