morpheus-cli 5.3.3 → 5.4.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/account_users_interface.rb +68 -0
- data/lib/morpheus/api/api_client.rb +75 -8
- data/lib/morpheus/api/audit_interface.rb +9 -0
- 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 +21 -0
- data/lib/morpheus/api/load_balancer_monitors_interface.rb +9 -0
- data/lib/morpheus/api/load_balancer_profiles_interface.rb +9 -0
- data/lib/morpheus/api/load_balancer_virtual_servers_interface.rb +9 -0
- data/lib/morpheus/api/load_balancers_interface.rb +5 -0
- 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 +30 -0
- data/lib/morpheus/api/network_servers_interface.rb +98 -0
- data/lib/morpheus/api/network_static_routes_interface.rb +36 -0
- data/lib/morpheus/api/read_interface.rb +4 -3
- data/lib/morpheus/api/rest_interface.rb +5 -4
- data/lib/morpheus/api/roles_interface.rb +7 -0
- data/lib/morpheus/api/secondary_read_interface.rb +1 -1
- data/lib/morpheus/api/secondary_rest_interface.rb +19 -19
- data/lib/morpheus/api/storage_server_types_interface.rb +14 -0
- data/lib/morpheus/api/storage_servers_interface.rb +9 -0
- data/lib/morpheus/api/storage_volume_types_interface.rb +9 -0
- data/lib/morpheus/api/storage_volumes_interface.rb +9 -0
- data/lib/morpheus/api/users_interface.rb +16 -63
- data/lib/morpheus/api/virtual_servers_interface.rb +9 -0
- data/lib/morpheus/cli/cli_command.rb +262 -14
- data/lib/morpheus/cli/cli_registry.rb +2 -1
- 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} +1 -4
- 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} +14 -87
- data/lib/morpheus/cli/{archives_command.rb → commands/archives_command.rb} +0 -6
- data/lib/morpheus/cli/commands/audit.rb +188 -0
- 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} +1 -1
- 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} +1 -5
- data/lib/morpheus/cli/{clouds.rb → commands/clouds.rb} +22 -47
- data/lib/morpheus/cli/{clusters.rb → commands/clusters.rb} +38 -19
- 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} +15 -25
- data/lib/morpheus/cli/{image_builder_command.rb → commands/image_builder_command.rb} +6 -16
- data/lib/morpheus/cli/{instance_types.rb → commands/instance_types.rb} +0 -3
- data/lib/morpheus/cli/{instances.rb → commands/instances.rb} +220 -13
- data/lib/morpheus/cli/{integrations_command.rb → commands/integrations_command.rb} +1 -12
- data/lib/morpheus/cli/{invoices_command.rb → commands/invoices_command.rb} +43 -39
- 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} +0 -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_monitors.rb +70 -0
- data/lib/morpheus/cli/commands/load_balancer_pools.rb +90 -0
- data/lib/morpheus/cli/commands/load_balancer_profiles.rb +64 -0
- data/lib/morpheus/cli/{load_balancer_types.rb → commands/load_balancer_types.rb} +9 -8
- data/lib/morpheus/cli/commands/load_balancer_virtual_servers.rb +147 -0
- data/lib/morpheus/cli/commands/load_balancers.rb +192 -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} +0 -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 +823 -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} +387 -57
- data/lib/morpheus/cli/{network_services_command.rb → commands/network_services_command.rb} +0 -4
- data/lib/morpheus/cli/commands/network_static_routes_command.rb +446 -0
- data/lib/morpheus/cli/commands/network_transport_zones_command.rb +452 -0
- data/lib/morpheus/cli/{networks_command.rb → commands/networks_command.rb} +20 -20
- data/lib/morpheus/cli/commands/open_command.rb +30 -0
- data/lib/morpheus/cli/commands/options.rb +98 -0
- 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} +1 -8
- 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} +7 -7
- 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} +5 -9
- 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} +245 -40
- 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} +4 -105
- 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/commands/storage_server_types.rb +50 -0
- data/lib/morpheus/cli/commands/storage_servers.rb +122 -0
- data/lib/morpheus/cli/commands/storage_volume_types.rb +50 -0
- data/lib/morpheus/cli/commands/storage_volumes.rb +103 -0
- 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} +1 -8
- 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} +1 -2
- data/lib/morpheus/cli/{user_settings_command.rb → commands/user_settings_command.rb} +2 -1
- data/lib/morpheus/cli/{user_sources_command.rb → commands/user_sources_command.rb} +1 -2
- data/lib/morpheus/cli/{users.rb → commands/users.rb} +28 -35
- 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} +0 -0
- data/lib/morpheus/cli/commands/{standard/version_command.rb → version_command.rb} +0 -0
- data/lib/morpheus/cli/commands/view.rb +102 -0
- data/lib/morpheus/cli/{virtual_images.rb → commands/virtual_images.rb} +2 -4
- 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/accounts_helper.rb +5 -5
- data/lib/morpheus/cli/mixins/load_balancers_helper.rb +26 -6
- data/lib/morpheus/cli/mixins/logs_helper.rb +1 -1
- data/lib/morpheus/cli/mixins/print_helper.rb +51 -18
- data/lib/morpheus/cli/mixins/processes_helper.rb +1 -2
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +48 -17
- data/lib/morpheus/cli/mixins/rest_command.rb +270 -94
- data/lib/morpheus/cli/mixins/secondary_rest_command.rb +667 -0
- data/lib/morpheus/cli/mixins/storage_servers_helper.rb +156 -0
- data/lib/morpheus/cli/mixins/storage_volumes_helper.rb +119 -0
- data/lib/morpheus/cli/option_types.rb +149 -40
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +6 -128
- data/lib/morpheus/ext/string.rb +29 -6
- data/lib/morpheus/routes.rb +238 -0
- data/lib/morpheus/terminal.rb +5 -6
- data/lib/morpheus/util.rb +6 -1
- metadata +176 -141
- 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,18 +1,6 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
|
-
require "shellwords"
|
|
6
|
-
require 'readline'
|
|
7
|
-
require 'logger'
|
|
8
|
-
require 'fileutils'
|
|
9
|
-
require 'morpheus/cli/cli_registry'
|
|
10
1
|
require 'morpheus/cli/cli_command'
|
|
11
|
-
require
|
|
12
|
-
require
|
|
13
|
-
require 'morpheus/terminal'
|
|
14
|
-
require 'morpheus/logging'
|
|
15
|
-
require 'morpheus/benchmarking'
|
|
2
|
+
require "shellwords"
|
|
3
|
+
require "readline"
|
|
16
4
|
|
|
17
5
|
#class Morpheus::Cli::Shell < Morpheus::Terminal
|
|
18
6
|
class Morpheus::Cli::Shell
|
|
@@ -391,102 +379,14 @@ class Morpheus::Cli::Shell
|
|
|
391
379
|
elsif input =~ /^\s*#/
|
|
392
380
|
Morpheus::Logging::DarkPrinter.puts "ignored comment: #{input}" if Morpheus::Logging.debug?
|
|
393
381
|
return 0
|
|
394
|
-
# this is a full blown command now
|
|
395
|
-
# elsif input =~ /^sleep/
|
|
396
|
-
# sleep_sec = input.sub("sleep ", "").to_f
|
|
397
|
-
# if (!(sleep_sec > 0))
|
|
398
|
-
# # raise_command_error "sleep requires the argument [seconds]. eg. sleep 3.14"
|
|
399
|
-
# puts_error "sleep requires argument [seconds]. eg. sleep 3.14"
|
|
400
|
-
# return false
|
|
401
|
-
# end
|
|
402
|
-
# log_history_command(input)
|
|
403
|
-
# Morpheus::Logging::DarkPrinter.puts "sleeping for #{sleep_sec}s ... zzzZzzzZ" if Morpheus::Logging.debug?
|
|
404
|
-
# begin
|
|
405
|
-
# sleep(sleep_sec)
|
|
406
|
-
# rescue Interrupt
|
|
407
|
-
# Morpheus::Logging::DarkPrinter.puts "\nInterrupt. waking up from sleep early"
|
|
408
|
-
# end
|
|
409
|
-
# return 0
|
|
410
|
-
# elsif input =~ /^history/
|
|
411
|
-
# n_commands = input.sub(/^history\s?/, '').sub(/\-n\s?/, '')
|
|
412
|
-
# n_commands = n_commands.empty? ? 25 : n_commands.to_i
|
|
413
|
-
# cmd_numbers = @history.keys.last(n_commands)
|
|
414
|
-
# if cmd_numbers.size == 1
|
|
415
|
-
# puts "Last command"
|
|
416
|
-
# else
|
|
417
|
-
# puts "Last #{cmd_numbers.size} commands"
|
|
418
|
-
# end
|
|
419
|
-
# cmd_numbers.each do |cmd_number|
|
|
420
|
-
# cmd = @history[cmd_number]
|
|
421
|
-
# puts "#{cmd_number.to_s.rjust(3, ' ')} #{cmd}"
|
|
422
|
-
# end
|
|
423
|
-
# last_cmd = cmd_numbers.last ? @history[cmd_numbers.last] : nil
|
|
424
|
-
# if input != last_cmd # no consecutive
|
|
425
|
-
# log_history_command(input)
|
|
426
|
-
# end
|
|
427
|
-
# return 0
|
|
428
382
|
elsif input == 'clear'
|
|
429
383
|
print "\e[H\e[2J"
|
|
430
384
|
return 0
|
|
431
|
-
# elsif input == 'flush-history' || input == 'flush_history'
|
|
432
|
-
# file_path = history_file_path
|
|
433
|
-
# if File.exists?(file_path)
|
|
434
|
-
# File.truncate(file_path, 0)
|
|
435
|
-
# end
|
|
436
|
-
# @history = {}
|
|
437
|
-
# @last_command_number = 0
|
|
438
|
-
# @history_logger = load_history_logger
|
|
439
|
-
# puts "history cleared!"
|
|
440
|
-
# return 0
|
|
441
|
-
# elsif input == "edit rc"
|
|
442
|
-
# fn = Morpheus::Cli::DotFile.morpheusrc_filename
|
|
443
|
-
# editor = ENV['EDITOR'] # || 'nano'
|
|
444
|
-
# if !editor
|
|
445
|
-
# puts "You have no EDITOR defined. Use 'export EDITOR=emacs'"
|
|
446
|
-
# #puts "Trying nano..."
|
|
447
|
-
# #editor = "nano"
|
|
448
|
-
# end
|
|
449
|
-
# system("which #{editor} > /dev/null 2>&1")
|
|
450
|
-
# has_editor = $?.success?
|
|
451
|
-
# if has_editor
|
|
452
|
-
# puts "opening #{fn} for editing with #{editor} ..."
|
|
453
|
-
# system("#{editor} #{fn}")
|
|
454
|
-
# puts "Use 'reload' to re-execute your startup script #{File.basename(fn)}"
|
|
455
|
-
# else
|
|
456
|
-
# puts_error2 Morpheus::Terminal.angry_prompt
|
|
457
|
-
# puts_error "The defined EDITOR '#{editor}' was not found on your system."
|
|
458
|
-
# end
|
|
459
|
-
# return 0 # $?
|
|
460
|
-
# elsif input == "edit profile"
|
|
461
|
-
# fn = Morpheus::Cli::DotFile.morpheus_profile_filename
|
|
462
|
-
# editor = ENV['EDITOR'] # || 'nano'
|
|
463
|
-
# if !editor
|
|
464
|
-
# puts "You have no EDITOR defined. Use 'export EDITOR=emacs'."
|
|
465
|
-
# #puts "Trying nano..."
|
|
466
|
-
# #editor = "nano"
|
|
467
|
-
# end
|
|
468
|
-
# system("which #{editor} > /dev/null 2>&1")
|
|
469
|
-
# has_editor = $?.success?
|
|
470
|
-
# if has_editor
|
|
471
|
-
# puts "opening #{fn} for editing with #{editor} ..."
|
|
472
|
-
# `#{editor} #{fn}`
|
|
473
|
-
# puts "Use 'reload' to re-execute your startup script #{File.basename(fn)}"
|
|
474
|
-
# else
|
|
475
|
-
# puts_error Morpheus::Terminal.angry_prompt
|
|
476
|
-
# puts_error "The defined EDITOR '#{editor}' was not found on your system."
|
|
477
|
-
# end
|
|
478
|
-
# return 0 # $?
|
|
479
385
|
elsif input == 'reload' || input == 'reload!'
|
|
480
|
-
# raise RestartShellPlease
|
|
481
|
-
#log_history_command(input)
|
|
482
|
-
# could just fork instead?
|
|
483
386
|
# clear registry
|
|
484
387
|
Morpheus::Cli::CliRegistry.instance.flush
|
|
485
388
|
# reload code
|
|
486
389
|
Morpheus::Cli.load!
|
|
487
|
-
|
|
488
|
-
# raise RestartShellPlease
|
|
489
|
-
|
|
490
390
|
# execute startup scripts
|
|
491
391
|
if File.exists?(Morpheus::Cli::DotFile.morpheus_profile_filename)
|
|
492
392
|
Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheus_profile_filename).execute()
|
|
@@ -494,7 +394,6 @@ class Morpheus::Cli::Shell
|
|
|
494
394
|
if File.exists?(Morpheus::Cli::DotFile.morpheusrc_filename)
|
|
495
395
|
Morpheus::Cli::DotFile.new(Morpheus::Cli::DotFile.morpheusrc_filename).execute()
|
|
496
396
|
end
|
|
497
|
-
|
|
498
397
|
# recalculate shell environment
|
|
499
398
|
reinitialize()
|
|
500
399
|
|
|
@@ -824,10 +723,10 @@ class Morpheus::Cli::Shell
|
|
|
824
723
|
end
|
|
825
724
|
if options[:show_pagination]
|
|
826
725
|
if options[:phrase] || options[:sort] || options[:direction] || options[:offset]
|
|
827
|
-
print_results_pagination(
|
|
726
|
+
print_results_pagination(history_result[:meta])
|
|
828
727
|
else
|
|
829
728
|
# default order is weird, it's the last page of results, 1-25 is misleading and showing the indexes is stranger
|
|
830
|
-
print_results_pagination(
|
|
729
|
+
print_results_pagination(history_result[:meta], {:message =>"Viewing most recent %{size} of %{total} %{label}"})
|
|
831
730
|
end
|
|
832
731
|
print reset, "\n"
|
|
833
732
|
else
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageServerTypes
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageServersHelper
|
|
7
|
+
|
|
8
|
+
set_command_description "View storage server types"
|
|
9
|
+
set_command_name :'storage-server-types'
|
|
10
|
+
register_subcommands :list, :get
|
|
11
|
+
|
|
12
|
+
# register_interfaces :storage_server_types
|
|
13
|
+
|
|
14
|
+
protected
|
|
15
|
+
|
|
16
|
+
def storage_server_type_list_column_definitions(options)
|
|
17
|
+
{
|
|
18
|
+
"ID" => 'id',
|
|
19
|
+
"Name" => 'name',
|
|
20
|
+
"Code" => 'code',
|
|
21
|
+
"Description" => 'description',
|
|
22
|
+
}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def storage_server_type_column_definitions(options)
|
|
26
|
+
{
|
|
27
|
+
"ID" => 'id',
|
|
28
|
+
"Name" => 'name',
|
|
29
|
+
"Code" => 'code',
|
|
30
|
+
"Description" => 'description',
|
|
31
|
+
"Creatable" => lambda {|it| format_boolean(it['creatable']) },
|
|
32
|
+
"Create Namespaces" => lambda {|it| format_boolean(it['createNamespaces']) },
|
|
33
|
+
"Create Groups" => lambda {|it| format_boolean(it['createGroups']) },
|
|
34
|
+
"Create Hosts" => lambda {|it| format_boolean(it['createHosts']) },
|
|
35
|
+
"Create Disks" => lambda {|it| format_boolean(it['createDisks']) },
|
|
36
|
+
"Has Namespaces" => lambda {|it| format_boolean(it['hasNamespaces']) },
|
|
37
|
+
"Has Groups" => lambda {|it| format_boolean(it['hasGroups']) },
|
|
38
|
+
"Has Hosts" => lambda {|it| format_boolean(it['hasHosts']) },
|
|
39
|
+
"Has Disks" => lambda {|it| format_boolean(it['hasDisks']) },
|
|
40
|
+
"Has File Browser" => lambda {|it| format_boolean(it['hasFileBrowser']) },
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# overridden to support name or code
|
|
45
|
+
def find_storage_server_type_by_name_or_id(name)
|
|
46
|
+
storage_server_type_for_name_or_id(name)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageServers
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageServersHelper
|
|
7
|
+
|
|
8
|
+
set_command_name :'storage-servers'
|
|
9
|
+
set_command_description "View and manage storage servers."
|
|
10
|
+
register_subcommands :list, :get, :add, :update, :remove
|
|
11
|
+
|
|
12
|
+
# RestCommand settings
|
|
13
|
+
register_interfaces :storage_servers, :storage_server_types
|
|
14
|
+
set_rest_has_type true
|
|
15
|
+
# set_rest_type :storage_server_types
|
|
16
|
+
|
|
17
|
+
def render_response_for_get(json_response, options)
|
|
18
|
+
render_response(json_response, options, rest_object_key) do
|
|
19
|
+
record = json_response[rest_object_key]
|
|
20
|
+
print_h1 rest_label, [], options
|
|
21
|
+
print cyan
|
|
22
|
+
print_description_list(rest_column_definitions(options), record, options)
|
|
23
|
+
# show Storage Server Configuration
|
|
24
|
+
config = record['config']
|
|
25
|
+
if config && !config.empty?
|
|
26
|
+
print_h2 "Configuration"
|
|
27
|
+
print_description_list(config.keys, config)
|
|
28
|
+
end
|
|
29
|
+
print reset,"\n"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
protected
|
|
34
|
+
|
|
35
|
+
def storage_server_list_column_definitions(options)
|
|
36
|
+
{
|
|
37
|
+
"ID" => 'id',
|
|
38
|
+
"Name" => 'name',
|
|
39
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
40
|
+
"Service URL" => lambda {|it| it['serviceUrl'] },
|
|
41
|
+
"Tenants" => lambda {|it|
|
|
42
|
+
if it['tenants'] && !it['tenants'].empty?
|
|
43
|
+
it['tenants'].collect {|account| account['name'] }.join(', ')
|
|
44
|
+
else
|
|
45
|
+
it['owner'] ? it['owner']['name'] : (it['account'] ? it['account']['name'] : nil)
|
|
46
|
+
end
|
|
47
|
+
},
|
|
48
|
+
"Status" => lambda {|it| format_storage_server_status(it) },
|
|
49
|
+
}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def storage_server_column_definitions(options)
|
|
53
|
+
{
|
|
54
|
+
"ID" => 'id',
|
|
55
|
+
"Name" => 'name',
|
|
56
|
+
"Description" => 'description',
|
|
57
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
58
|
+
"Service URL" => lambda {|it| it['serviceUrl'] },
|
|
59
|
+
"Service Username" => lambda {|it| it['serviceUsername'] },
|
|
60
|
+
"Tenants" => lambda {|it| it['tenants'].collect {|account| account['name'] }.join(', ') },
|
|
61
|
+
"Owner" => lambda {|it| it['owner'] ? it['owner']['name'] : (it['account'] ? it['account']['name'] : nil) },
|
|
62
|
+
"Enabled" => lambda {|it| format_boolean(it['enabled']) },
|
|
63
|
+
"Status" => lambda {|it| format_storage_server_status(it) },
|
|
64
|
+
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
|
65
|
+
"Updated" => lambda {|it| format_local_dt(it['lastUpdated']) }
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# overridden to work with name or code
|
|
70
|
+
# nope, api works with name=code now too
|
|
71
|
+
# def find_storage_server_type_by_name_or_id(name)
|
|
72
|
+
# storage_server_type_for_name_or_id(name)
|
|
73
|
+
# end
|
|
74
|
+
|
|
75
|
+
def add_storage_server_option_types()
|
|
76
|
+
[
|
|
77
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true},
|
|
78
|
+
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'required' => false},
|
|
79
|
+
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox', 'required' => false, 'defaultValue' => true},
|
|
80
|
+
# {'fieldName' => 'type', 'fieldLabel' => 'Storage Server Type', 'type' => 'select', 'optionSource' => 'storageServerTypes', 'required' => true},
|
|
81
|
+
]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def add_storage_server_advanced_option_types()
|
|
85
|
+
[
|
|
86
|
+
{'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'fieldGroup' => 'Advanced', 'type' => 'select', 'selectOptions' => [{'name' => 'Private', 'value' => 'private'},{'name' => 'Public', 'value' => 'public'}], 'required' => false, 'description' => 'Visibility', 'category' => 'permissions'},
|
|
87
|
+
{'fieldName' => 'tenants', 'fieldLabel' => 'Tenants', 'fieldGroup' => 'Advanced', 'type' => 'multiSelect', 'optionSource' => lambda { |api_client, api_params|
|
|
88
|
+
api_client.options.options_for_source("allTenants", {})['data']
|
|
89
|
+
}},
|
|
90
|
+
]
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def update_storage_server_option_types()
|
|
94
|
+
[
|
|
95
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text'},
|
|
96
|
+
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text'},
|
|
97
|
+
{'fieldName' => 'enabled', 'fieldLabel' => 'Enabled', 'type' => 'checkbox'},
|
|
98
|
+
]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def update_storage_server_advanced_option_types()
|
|
102
|
+
add_storage_server_advanced_option_types()
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def format_storage_server_status(storage_server, return_color=cyan)
|
|
106
|
+
out = ""
|
|
107
|
+
status_string = storage_server['status']
|
|
108
|
+
if storage_server['enabled'] == false
|
|
109
|
+
out << "#{red}DISABLED#{return_color}"
|
|
110
|
+
elsif status_string.nil? || status_string.empty? || status_string == "unknown"
|
|
111
|
+
out << "#{white}UNKNOWN#{return_color}"
|
|
112
|
+
elsif status_string == 'ok'
|
|
113
|
+
out << "#{green}#{status_string.upcase}#{return_color}"
|
|
114
|
+
elsif status_string == 'syncing'
|
|
115
|
+
out << "#{yellow}#{status_string.upcase}#{return_color}"
|
|
116
|
+
else
|
|
117
|
+
out << "#{red}#{status_string ? status_string.upcase : 'N/A'}#{storage_server['statusMessage'] ? "#{return_color} - #{storage_server['statusMessage']}" : ''}#{return_color}"
|
|
118
|
+
end
|
|
119
|
+
out
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageVolumeTypes
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageVolumesHelper
|
|
7
|
+
|
|
8
|
+
set_command_name :'storage-volume-types'
|
|
9
|
+
register_subcommands :list, :get
|
|
10
|
+
|
|
11
|
+
# register_interfaces :storage_volume_types
|
|
12
|
+
|
|
13
|
+
protected
|
|
14
|
+
|
|
15
|
+
def build_list_options(opts, options, params)
|
|
16
|
+
opts.on('--name VALUE', String, "Filter by name") do |val|
|
|
17
|
+
params['name'] = val
|
|
18
|
+
end
|
|
19
|
+
opts.on('--category VALUE', String, "Filter by category") do |val|
|
|
20
|
+
params['category'] = val
|
|
21
|
+
end
|
|
22
|
+
# build_standard_list_options(opts, options)
|
|
23
|
+
super
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def storage_volume_type_list_column_definitions(options)
|
|
27
|
+
{
|
|
28
|
+
"ID" => 'id',
|
|
29
|
+
"Name" => 'name',
|
|
30
|
+
"Code" => 'code',
|
|
31
|
+
"Description" => 'description',
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def storage_volume_type_column_definitions(options)
|
|
36
|
+
{
|
|
37
|
+
"ID" => 'id',
|
|
38
|
+
"Name" => 'name',
|
|
39
|
+
"Code" => 'code',
|
|
40
|
+
"Description" => 'description',
|
|
41
|
+
}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# overridden to support name or code
|
|
45
|
+
def find_storage_volume_type_by_name_or_id(name)
|
|
46
|
+
storage_volume_type_for_name_or_id(name)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::StorageVolumes
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::RestCommand
|
|
6
|
+
include Morpheus::Cli::StorageVolumesHelper
|
|
7
|
+
|
|
8
|
+
set_command_name :'storage-volumes'
|
|
9
|
+
set_command_description "View and manage storage volumes."
|
|
10
|
+
register_subcommands %w{list get add remove}
|
|
11
|
+
|
|
12
|
+
# RestCommand settings
|
|
13
|
+
register_interfaces :storage_volumes, :storage_volume_types
|
|
14
|
+
set_rest_has_type true
|
|
15
|
+
|
|
16
|
+
protected
|
|
17
|
+
|
|
18
|
+
def build_list_options(opts, options, params)
|
|
19
|
+
opts.on('--storage-server VALUE', String, "Storage Server Name or ID") do |val|
|
|
20
|
+
options[:storage_server] = val
|
|
21
|
+
end
|
|
22
|
+
opts.on('-t', '--type TYPE', "Filter by type") do |val|
|
|
23
|
+
params['type'] = val
|
|
24
|
+
end
|
|
25
|
+
opts.on('--name VALUE', String, "Filter by name") do |val|
|
|
26
|
+
params['name'] = val
|
|
27
|
+
end
|
|
28
|
+
opts.on('--category VALUE', String, "Filter by category") do |val|
|
|
29
|
+
params['category'] = val
|
|
30
|
+
end
|
|
31
|
+
# build_standard_list_options(opts, options)
|
|
32
|
+
super
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def parse_list_options!(args, options, params)
|
|
36
|
+
parse_parameter_as_resource_id!(:storage_server, options, params)
|
|
37
|
+
super
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def storage_volume_list_column_definitions(options)
|
|
41
|
+
{
|
|
42
|
+
"ID" => 'id',
|
|
43
|
+
"Name" => 'name',
|
|
44
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
45
|
+
"Source" => lambda {|it| format_storage_volume_source(it) },
|
|
46
|
+
"Storage" => lambda {|it| format_bytes(it['maxStorage']) },
|
|
47
|
+
"Status" => lambda {|it| format_storage_volume_status(it) },
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def storage_volume_column_definitions(options)
|
|
52
|
+
{
|
|
53
|
+
"ID" => 'id',
|
|
54
|
+
"Name" => 'name',
|
|
55
|
+
"Description" => 'description',
|
|
56
|
+
"Type" => lambda {|it| it['type'] ? it['type']['name'] : '' },
|
|
57
|
+
"Owner" => lambda {|it| it['owner'] ? it['owner']['name'] : (it['account'] ? it['account']['name'] : nil) },
|
|
58
|
+
"Cloud" => lambda {|it| it['zone']['name'] rescue '' },
|
|
59
|
+
"Datastore" => lambda {|it| it['datastore']['name'] rescue '' },
|
|
60
|
+
"Storage Group" => lambda {|it| it['storageGroup']['name'] rescue '' },
|
|
61
|
+
"Storage Server" => lambda {|it| it['storageServer']['name'] rescue '' },
|
|
62
|
+
"Source" => lambda {|it| format_storage_volume_source(it) },
|
|
63
|
+
"Storage" => lambda {|it| format_bytes(it['maxStorage']) },
|
|
64
|
+
"Status" => lambda {|it| format_storage_volume_status(it) },
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# overridden to work with name or code
|
|
69
|
+
# nope, api works with name=code now too
|
|
70
|
+
# def find_storage_volume_type_by_name_or_id(name)
|
|
71
|
+
# storage_volume_type_for_name_or_id(name)
|
|
72
|
+
# end
|
|
73
|
+
|
|
74
|
+
def add_storage_volume_option_types()
|
|
75
|
+
[
|
|
76
|
+
{'fieldContext' => 'storageServer', 'fieldName' => 'id', 'fieldLabel' => 'Storage Server', 'type' => 'select', 'optionSource' => 'storageServers', 'optionParams' => {'createType' => 'block'}, 'required' => true},
|
|
77
|
+
{'fieldContext' => 'storageGroup', 'fieldName' => 'id', 'fieldLabel' => 'Storage Group', 'type' => 'select', 'optionSource' => 'storageGroups', 'required' => true},
|
|
78
|
+
{'shorthand' => '-t', 'fieldName' => 'type', 'fieldLabel' => 'Storage Volume Type', 'type' => 'select', 'optionSource' => 'storageVolumeTypes', 'required' => true},
|
|
79
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true},
|
|
80
|
+
]
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def update_storage_volume_option_types()
|
|
84
|
+
[
|
|
85
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text'},
|
|
86
|
+
]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def load_option_types_for_storage_volume(type_record, parent_record)
|
|
90
|
+
storage_volume_type = type_record
|
|
91
|
+
option_types = storage_volume_type['optionTypes']
|
|
92
|
+
# ughhh, all this to change a label for API which uses bytes and not MB
|
|
93
|
+
if option_types
|
|
94
|
+
size_option_type = option_types.find {|it| it['fieldName'] == 'maxStorage' }
|
|
95
|
+
if size_option_type
|
|
96
|
+
#size_option_type['fieldLabel'] = "Volume Size (bytes)"
|
|
97
|
+
size_option_type['fieldAddOn'] = "bytes"
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
return option_types
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
end
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
require 'rest_client'
|
|
2
|
-
require 'optparse'
|
|
3
|
-
require 'filesize'
|
|
4
1
|
require 'morpheus/cli/cli_command'
|
|
5
|
-
require 'morpheus/cli/mixins/infrastructure_helper'
|
|
6
2
|
|
|
7
3
|
class Morpheus::Cli::SubnetsCommand
|
|
8
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -350,8 +346,13 @@ class Morpheus::Cli::SubnetsCommand
|
|
|
350
346
|
if subnet_type_option_types && subnet_type_option_types.size > 0
|
|
351
347
|
# prompt for option types
|
|
352
348
|
subnet_type_params = Morpheus::Cli::OptionTypes.prompt(subnet_type_option_types,options[:options],@api_client, {networkId: network['id'], zoneId: network['zone']['id']})
|
|
353
|
-
|
|
354
|
-
|
|
349
|
+
if subnet_type_params['subnet']
|
|
350
|
+
payload['subnet'].deep_merge!(subnet_type_params['subnet'])
|
|
351
|
+
end
|
|
352
|
+
if subnet_type_params['config']
|
|
353
|
+
payload['subnet']['config'] ||= {}
|
|
354
|
+
payload['subnet']['config'].deep_merge!(subnet_type_params['config'])
|
|
355
|
+
end
|
|
355
356
|
else
|
|
356
357
|
# DEFAULT INPUTS
|
|
357
358
|
|
|
@@ -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
|
|
@@ -25,7 +18,7 @@ class Morpheus::Cli::TenantsCommand
|
|
|
25
18
|
|
|
26
19
|
def connect(opts)
|
|
27
20
|
@api_client = establish_remote_appliance_connection(opts)
|
|
28
|
-
@
|
|
21
|
+
@account_users_interface = @api_client.account_users
|
|
29
22
|
@accounts_interface = @api_client.accounts
|
|
30
23
|
@roles_interface = @api_client.roles
|
|
31
24
|
end
|
|
File without changes
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'morpheus/cli/cli_command'
|
|
2
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
3
2
|
|
|
4
3
|
class Morpheus::Cli::UserGroupsCommand
|
|
5
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -13,7 +12,7 @@ class Morpheus::Cli::UserGroupsCommand
|
|
|
13
12
|
def connect(opts)
|
|
14
13
|
@api_client = establish_remote_appliance_connection(opts)
|
|
15
14
|
@user_groups_interface = @api_client.user_groups
|
|
16
|
-
@
|
|
15
|
+
@account_users_interface = @api_client.account_users
|
|
17
16
|
@accounts_interface = @api_client.accounts
|
|
18
17
|
end
|
|
19
18
|
|
|
@@ -17,7 +17,8 @@ class Morpheus::Cli::UserSettingsCommand
|
|
|
17
17
|
def connect(opts)
|
|
18
18
|
@api_client = establish_remote_appliance_connection(opts)
|
|
19
19
|
@user_settings_interface = @api_client.user_settings
|
|
20
|
-
@
|
|
20
|
+
@accounts_interface = @api_client.accounts
|
|
21
|
+
@account_users_interface = @api_client.account_users
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
def handle(args)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
require 'morpheus/cli/cli_command'
|
|
2
|
-
require 'morpheus/cli/mixins/accounts_helper'
|
|
3
2
|
|
|
4
3
|
class Morpheus::Cli::UserSourcesCommand
|
|
5
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -22,7 +21,7 @@ class Morpheus::Cli::UserSourcesCommand
|
|
|
22
21
|
@api_client = establish_remote_appliance_connection(opts)
|
|
23
22
|
@user_sources_interface = @api_client.user_sources
|
|
24
23
|
@accounts_interface = @api_client.accounts
|
|
25
|
-
@
|
|
24
|
+
@account_users_interface = @api_client.account_users
|
|
26
25
|
end
|
|
27
26
|
|
|
28
27
|
def handle(args)
|