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,10 +1,4 @@
|
|
|
1
|
-
# require 'yaml'
|
|
2
|
-
require 'io/console'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
|
-
require 'filesize'
|
|
6
1
|
require 'morpheus/cli/cli_command'
|
|
7
|
-
#require 'morpheus/cli/mixins/infrastructure_helper'
|
|
8
2
|
|
|
9
3
|
class Morpheus::Cli::Clusters
|
|
10
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -564,13 +558,10 @@ class Morpheus::Cli::Clusters
|
|
|
564
558
|
|
|
565
559
|
cluster_payload['layout'] = {id: layout['id']}
|
|
566
560
|
|
|
567
|
-
#
|
|
561
|
+
# Provision Type
|
|
568
562
|
provision_type = (layout && layout['provisionType'] ? layout['provisionType'] : nil) || get_provision_type_for_zone_type(cloud['zoneType']['id'])
|
|
569
|
-
service_plan = prompt_service_plan(cloud['id'], provision_type, options)
|
|
570
563
|
|
|
571
|
-
|
|
572
|
-
server_payload['plan'] = {'id' => service_plan['id'], 'code' => service_plan['code'], 'options' => prompt_service_plan_options(service_plan, options)}
|
|
573
|
-
end
|
|
564
|
+
api_params = {zoneId: cloud['id'], siteId: group['id'], layoutId: layout['id'], groupTypeId: cluster_type['id'], provisionTypeId: provision_type['id']}
|
|
574
565
|
|
|
575
566
|
# Controller type
|
|
576
567
|
server_types = @server_types_interface.list({max:1, computeTypeId: cluster_type['controllerTypes'].first['id'], zoneTypeId: cloud['zoneType']['id'], useZoneProvisionTypes: true})['serverTypes']
|
|
@@ -581,22 +572,47 @@ class Morpheus::Cli::Clusters
|
|
|
581
572
|
controller_type = server_types.first
|
|
582
573
|
controller_provision_type = controller_type['provisionType'] ? (@provision_types_interface.get(controller_type['provisionType']['id'])['provisionType'] rescue nil) : nil
|
|
583
574
|
|
|
584
|
-
if controller_provision_type && resource_pool = prompt_resource_pool(group, cloud,
|
|
585
|
-
|
|
575
|
+
if controller_provision_type && resource_pool = prompt_resource_pool(group, cloud, nil, controller_provision_type, options)
|
|
576
|
+
server_payload['config']['resourcePoolId'] = resource_pool['id']
|
|
577
|
+
api_params['config'] ||= {}
|
|
578
|
+
api_params['config']['resourcePool'] = resource_pool['id']
|
|
579
|
+
api_params['resourcePoolId'] = resource_pool['id']
|
|
580
|
+
api_params['zonePoolId'] = resource_pool['id']
|
|
586
581
|
end
|
|
587
582
|
end
|
|
588
583
|
|
|
584
|
+
# Service Plan
|
|
585
|
+
service_plan = prompt_service_plan(api_params, options)
|
|
586
|
+
|
|
587
|
+
if service_plan
|
|
588
|
+
server_payload['plan'] = {'id' => service_plan['id'], 'code' => service_plan['code'], 'options' => prompt_service_plan_options(service_plan, options)}
|
|
589
|
+
api_params['planId'] = service_plan['id']
|
|
590
|
+
end
|
|
591
|
+
|
|
589
592
|
# Multi-disk / prompt for volumes
|
|
590
|
-
volumes = options[:volumes] || prompt_volumes(service_plan, options.merge({'defaultAddFirstDataVolume': true}), @api_client,
|
|
593
|
+
volumes = options[:volumes] || prompt_volumes(service_plan, options.merge({'defaultAddFirstDataVolume': true}), @api_client, api_params)
|
|
591
594
|
|
|
592
595
|
if !volumes.empty?
|
|
593
596
|
server_payload['volumes'] = volumes
|
|
594
597
|
end
|
|
595
598
|
|
|
599
|
+
# Options / Custom Config
|
|
600
|
+
option_type_list =
|
|
601
|
+
((controller_type['optionTypes'].reject { |type| !type['enabled'] || type['fieldComponent'] } rescue []) + layout['optionTypes'] +
|
|
602
|
+
(cluster_type['optionTypes'].reject { |type| !type['enabled'] || !type['creatable'] || type['fieldComponent'] } rescue [])).sort { |type| type['displayOrder'] }
|
|
603
|
+
|
|
604
|
+
# KLUDGE: google zone required for network selection
|
|
605
|
+
if option_type = option_type_list.find {|type| type['code'] == 'computeServerType.googleLinux.googleZoneId'}
|
|
606
|
+
server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt([option_type], options[:options], @api_client, api_params))
|
|
607
|
+
api_params.deep_merge!(server_payload)
|
|
608
|
+
api_params.deep_merge!(server_payload['config'])
|
|
609
|
+
option_type_list = option_type_list.reject {|type| type['code'] == 'computeServerType.googleLinux.googleZoneId'}
|
|
610
|
+
end
|
|
611
|
+
|
|
596
612
|
# Networks
|
|
597
613
|
# NOTE: You must choose subnets in the same availability zone
|
|
598
614
|
if controller_provision_type && controller_provision_type['hasNetworks'] && cloud['zoneType']['code'] != 'esxi'
|
|
599
|
-
server_payload['networkInterfaces'] = options[:networkInterfaces] || prompt_network_interfaces(cloud['id'], provision_type['id'], (resource_pool['id'] rescue nil), options)
|
|
615
|
+
server_payload['networkInterfaces'] = options[:networkInterfaces] || prompt_network_interfaces(cloud['id'], provision_type['id'], (resource_pool['id'] rescue nil), options.merge({:api_params => api_params}))
|
|
600
616
|
end
|
|
601
617
|
|
|
602
618
|
# Security Groups
|
|
@@ -605,15 +621,11 @@ class Morpheus::Cli::Clusters
|
|
|
605
621
|
# Visibility
|
|
606
622
|
server_payload['visibility'] = options[:visibility] || (Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'visibility', 'fieldLabel' => 'Visibility', 'type' => 'select', 'defaultValue' => 'private', 'required' => true, 'selectOptions' => [{'name' => 'Private', 'value' => 'private'},{'name' => 'Public', 'value' => 'public'}]}], options[:options], @api_client, {})['visibility'])
|
|
607
623
|
|
|
608
|
-
|
|
609
|
-
option_type_list = ((controller_type['optionTypes'].reject { |type| !type['enabled'] || type['fieldComponent'] } rescue []) + layout['optionTypes'] +
|
|
610
|
-
(cluster_type['optionTypes'].reject { |type| !type['enabled'] || !type['creatable'] || type['fieldComponent'] } rescue [])).sort { |type| type['displayOrder'] }
|
|
611
|
-
|
|
612
|
-
server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(option_type_list, options[:options], @api_client, {zoneId: cloud['id'], siteId: group['id'], layoutId: layout['id']}))
|
|
624
|
+
server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(option_type_list, options[:options], @api_client, api_params, options[:no_prompt], true))
|
|
613
625
|
|
|
614
626
|
# Worker count
|
|
615
627
|
default_node_count = layout['computeServers'] ? (layout['computeServers'].find {|it| it['nodeType'] == 'worker'} || {'nodeCount' => 3})['nodeCount'] : 3
|
|
616
|
-
server_payload['nodeCount'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => "nodeCount", 'type' => 'number', 'fieldLabel' => "#{cluster_type['code'].include?('docker') ? 'Host' : 'Worker'} Count", 'required' => true, 'defaultValue' => default_node_count}], options[:options], @api_client,
|
|
628
|
+
server_payload['config']['nodeCount'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => "config.nodeCount", 'type' => 'number', 'fieldLabel' => "#{cluster_type['code'].include?('docker') ? 'Host' : 'Worker'} Count", 'required' => true, 'defaultValue' => default_node_count > 0 ? default_node_count : 3}], options[:options], @api_client, api_params, options[:no_prompt])['config']['nodeCount']
|
|
617
629
|
|
|
618
630
|
# Create User
|
|
619
631
|
if !options[:createUser].nil?
|
|
@@ -629,7 +641,7 @@ class Morpheus::Cli::Clusters
|
|
|
629
641
|
if userGroup
|
|
630
642
|
server_payload['userGroup'] = userGroup
|
|
631
643
|
elsif !options[:no_prompt]
|
|
632
|
-
userGroupId = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'userGroupId', 'fieldLabel' => 'User Group', 'type' => 'select', 'required' => false, 'optionSource' => 'userGroups'}], options[:options], @api_client,
|
|
644
|
+
userGroupId = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'userGroupId', 'fieldLabel' => 'User Group', 'type' => 'select', 'required' => false, 'optionSource' => 'userGroups'}], options[:options], @api_client, api_params)['userGroupId']
|
|
633
645
|
|
|
634
646
|
if userGroupId
|
|
635
647
|
server_payload['userGroup'] = {'id' => userGroupId}
|
|
@@ -637,11 +649,11 @@ class Morpheus::Cli::Clusters
|
|
|
637
649
|
end
|
|
638
650
|
|
|
639
651
|
# Host / Domain
|
|
640
|
-
server_payload['networkDomain'] = options[:domain] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'networkDomain', 'fieldLabel' => 'Network Domain', 'type' => 'select', 'required' => false, 'optionSource' => 'networkDomains'}], options[:options], @api_client,
|
|
641
|
-
server_payload['hostname'] = options[:hostname] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'hostname', 'fieldLabel' => 'Hostname', 'type' => 'text', 'required' => true, 'description' => 'Hostname', 'defaultValue' => resourceName}], options[:options], @api_client)['hostname']
|
|
652
|
+
server_payload['networkDomain'] = options[:domain] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'networkDomain', 'fieldLabel' => 'Network Domain', 'type' => 'select', 'required' => false, 'optionSource' => 'networkDomains'}], options[:options], @api_client, api_params)['networkDomain']
|
|
653
|
+
server_payload['hostname'] = options[:hostname] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'hostname', 'fieldLabel' => 'Hostname', 'type' => 'text', 'required' => true, 'description' => 'Hostname', 'defaultValue' => resourceName}], options[:options], @api_client, api_params)['hostname']
|
|
642
654
|
|
|
643
655
|
# Workflow / Automation
|
|
644
|
-
task_set_id = options[:taskSetId] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'taskSet', 'fieldLabel' => 'Workflow', 'type' => 'select', 'required' => false, 'optionSource' => 'taskSets'}], options[:options], @api_client, {'phase' => 'postProvision'})['taskSet']
|
|
656
|
+
task_set_id = options[:taskSetId] || Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'taskSet', 'fieldLabel' => 'Workflow', 'type' => 'select', 'required' => false, 'optionSource' => 'taskSets'}], options[:options], @api_client, api_params.merge({'phase' => 'postProvision'}))['taskSet']
|
|
645
657
|
|
|
646
658
|
if !task_set_id.nil?
|
|
647
659
|
server_payload['taskSet'] = {'id' => task_set_id}
|
|
@@ -1147,20 +1159,20 @@ class Morpheus::Cli::Clusters
|
|
|
1147
1159
|
cloud_id = (default_cloud && cloud_id == default_cloud['name']) ? default_cloud['value'] : cloud_id
|
|
1148
1160
|
end
|
|
1149
1161
|
|
|
1162
|
+
# resources (zone pools)
|
|
1163
|
+
cloud = @clouds_interface.get(cloud_id)['zone']
|
|
1164
|
+
cloud['zoneType'] = get_cloud_type(cloud['zoneType']['id'])
|
|
1165
|
+
group = @groups_interface.get(cluster['site']['id'])['group']
|
|
1166
|
+
|
|
1150
1167
|
server_payload['cloud'] = {'id' => cloud_id}
|
|
1151
|
-
service_plan = prompt_service_plan(cloud_id, server_type['provisionType'], options)
|
|
1168
|
+
service_plan = prompt_service_plan({zoneId: cloud_id, siteId: cluster['site']['id'], provisionTypeId: server_type['provisionType']['id'], groupTypeId: cluster_type['id'], }, options)
|
|
1152
1169
|
|
|
1153
1170
|
if service_plan
|
|
1154
1171
|
server_payload['plan'] = {'code' => service_plan['code'], 'options' => prompt_service_plan_options(service_plan, options)}
|
|
1155
1172
|
end
|
|
1156
1173
|
|
|
1157
|
-
# resources (zone pools)
|
|
1158
|
-
cloud = @clouds_interface.get(cloud_id)['zone']
|
|
1159
|
-
cloud['zoneType'] = get_cloud_type(cloud['zoneType']['id'])
|
|
1160
|
-
group = @groups_interface.get(cluster['site']['id'])['group']
|
|
1161
|
-
|
|
1162
1174
|
if resource_pool = prompt_resource_pool(cluster, cloud, service_plan, server_type['provisionType'], options)
|
|
1163
|
-
server_payload['config']['
|
|
1175
|
+
server_payload['config']['resourcePoolId'] = resource_pool['id']
|
|
1164
1176
|
end
|
|
1165
1177
|
|
|
1166
1178
|
# Multi-disk / prompt for volumes
|
|
@@ -1181,7 +1193,7 @@ class Morpheus::Cli::Clusters
|
|
|
1181
1193
|
server_payload['securityGroups'] = prompt_security_groups_by_cloud(cloud, provision_type, resource_pool, options)
|
|
1182
1194
|
|
|
1183
1195
|
# Worker count
|
|
1184
|
-
default_node_count = layout['computeServers'] ? (layout['computeServers'].find {|it| it['nodeType'] == 'worker'} || {'nodeCount' =>
|
|
1196
|
+
default_node_count = layout['computeServers'] ? (layout['computeServers'].find {|it| it['nodeType'] == 'worker'} || {'nodeCount' => 1})['nodeCount'] : 1
|
|
1185
1197
|
server_payload['nodeCount'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => "nodeCount", 'type' => 'number', 'fieldLabel' => "#{cluster_type['code'].include?('docker') ? 'Host' : 'Worker'} Count", 'required' => true, 'defaultValue' => default_node_count}], options[:options], @api_client, {}, options[:no_prompt])["nodeCount"]
|
|
1186
1198
|
|
|
1187
1199
|
# Options / Custom Config
|
|
@@ -3635,8 +3647,8 @@ class Morpheus::Cli::Clusters
|
|
|
3635
3647
|
@server_types_interface.get(val)['serverType']
|
|
3636
3648
|
end
|
|
3637
3649
|
|
|
3638
|
-
def service_plans_for_dropdown(
|
|
3639
|
-
@servers_interface.service_plans(
|
|
3650
|
+
def service_plans_for_dropdown(api_params)
|
|
3651
|
+
@servers_interface.service_plans(api_params)['plans'] rescue []
|
|
3640
3652
|
end
|
|
3641
3653
|
|
|
3642
3654
|
def namespace_service_plans
|
|
@@ -3679,10 +3691,10 @@ class Morpheus::Cli::Clusters
|
|
|
3679
3691
|
@groups_interface.get(group_id)['group']
|
|
3680
3692
|
end
|
|
3681
3693
|
|
|
3682
|
-
def prompt_service_plan(
|
|
3683
|
-
available_service_plans = service_plans_for_dropdown(
|
|
3694
|
+
def prompt_service_plan(api_params, options)
|
|
3695
|
+
available_service_plans = service_plans_for_dropdown(api_params)
|
|
3684
3696
|
if available_service_plans.empty?
|
|
3685
|
-
print_red_alert "Cloud #{
|
|
3697
|
+
print_red_alert "Cloud #{api_params['zoneId']} has no available plans"
|
|
3686
3698
|
exit 1
|
|
3687
3699
|
end
|
|
3688
3700
|
if options[:servicePlan]
|
|
@@ -3853,7 +3865,7 @@ class Morpheus::Cli::Clusters
|
|
|
3853
3865
|
resource_pool = options[:resourcePool] ? find_cloud_resource_pool_by_name_or_id(cloud['id'], options[:resourcePool]) : nil
|
|
3854
3866
|
|
|
3855
3867
|
if !resource_pool
|
|
3856
|
-
resource_pool_options = @options_interface.options_for_source('zonePools', {groupId: group['id'], zoneId: cloud['id']
|
|
3868
|
+
resource_pool_options = @options_interface.options_for_source('zonePools', {groupId: group['id'], zoneId: cloud['id']}.merge(service_plan ? {planId: service_plan['id']} : {}))['data'].reject { |it| it['id'].nil? && it['name'].nil? }
|
|
3857
3869
|
|
|
3858
3870
|
if resource_pool_options.empty?
|
|
3859
3871
|
print_red_alert "Cloud #{cloud['name']} has no available resource pools"
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
require 'io/console'
|
|
2
|
-
require 'rest_client'
|
|
3
|
-
require 'optparse'
|
|
4
|
-
require 'filesize'
|
|
5
1
|
require 'morpheus/cli/cli_command'
|
|
6
|
-
require 'morpheus/cli/mixins/provisioning_helper'
|
|
7
|
-
require 'morpheus/cli/mixins/logs_helper'
|
|
8
|
-
require 'morpheus/cli/option_types'
|
|
9
2
|
|
|
10
3
|
class Morpheus::Cli::ContainersCommand
|
|
11
4
|
include Morpheus::Cli::CliCommand
|
|
File without changes
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
require 'morpheus/cli/cli_command'
|
|
2
|
-
require 'term/ansicolor'
|
|
3
|
-
require 'json'
|
|
4
2
|
|
|
5
|
-
# Command for editing the .morpheus_profile
|
|
3
|
+
# Command for editing the .morpheus_profile initialization script
|
|
6
4
|
class Morpheus::Cli::EditProfileCommand
|
|
7
5
|
include Morpheus::Cli::CliCommand
|
|
8
6
|
set_command_name :'edit-profile'
|
|
@@ -18,7 +16,20 @@ class Morpheus::Cli::EditProfileCommand
|
|
|
18
16
|
editor = val
|
|
19
17
|
end
|
|
20
18
|
build_common_options(opts, options, [])
|
|
21
|
-
opts.footer =
|
|
19
|
+
opts.footer = <<-EOT
|
|
20
|
+
Edit your .morpheus_profile script located in the morpheus home directory.
|
|
21
|
+
This script runs whenever the morpheus terminal command is executed.
|
|
22
|
+
It provides a way to initialize your cli environment for all morpheus commands.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
|
|
26
|
+
# disable coloring to exclude ansi characters in output
|
|
27
|
+
coloring off -q
|
|
28
|
+
|
|
29
|
+
# Enable debugging to print extra output for troubleshooting
|
|
30
|
+
debug on
|
|
31
|
+
|
|
32
|
+
EOT
|
|
22
33
|
end
|
|
23
34
|
optparse.parse!(args)
|
|
24
35
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
require 'morpheus/cli/cli_command'
|
|
2
|
-
require 'term/ansicolor'
|
|
3
|
-
require 'json'
|
|
4
2
|
|
|
5
3
|
# Command for editing the .morpheus_profile initalization script
|
|
6
4
|
class Morpheus::Cli::EditRcCommand
|
|
@@ -18,7 +16,25 @@ class Morpheus::Cli::EditRcCommand
|
|
|
18
16
|
editor = val.gsub("'",'')
|
|
19
17
|
end
|
|
20
18
|
build_common_options(opts, options, [])
|
|
21
|
-
opts.footer =
|
|
19
|
+
opts.footer = <<-EOT
|
|
20
|
+
Edit your .morpheusrc script located in the morpheus home directory.
|
|
21
|
+
This script runs at the beginning of the interactive morpheus shell command.
|
|
22
|
+
It provides a way to initialize your interactive morpheus shell environment.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
|
|
26
|
+
# customize the morpheus shell prompt
|
|
27
|
+
set-prompt "%cyan%username%reset@%magenta%remote %cyanmorpheus> %reset"
|
|
28
|
+
|
|
29
|
+
# print the morpheus cli version
|
|
30
|
+
version
|
|
31
|
+
|
|
32
|
+
# print the current remote appliance version
|
|
33
|
+
remote get current
|
|
34
|
+
|
|
35
|
+
# greetings
|
|
36
|
+
echo "Welcome back %username"
|
|
37
|
+
EOT
|
|
22
38
|
end
|
|
23
39
|
optparse.parse!(args)
|
|
24
40
|
|
data/lib/morpheus/cli/{execute_schedules_command.rb → commands/execute_schedules_command.rb}
RENAMED
|
File without changes
|
data/lib/morpheus/cli/{file_copy_request_command.rb → commands/file_copy_request_command.rb}
RENAMED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
require 'morpheus/cli/cli_command'
|
|
2
|
-
# require 'morpheus/cli/mixins/provisioning_helper'
|
|
3
|
-
# require 'morpheus/cli/mixins/infrastructure_helper'
|
|
4
2
|
|
|
5
3
|
class Morpheus::Cli::FileCopyRequestCommand
|
|
6
4
|
include Morpheus::Cli::CliCommand
|
|
7
|
-
# include Morpheus::Cli::InfrastructureHelper
|
|
8
|
-
# include Morpheus::Cli::ProvisioningHelper
|
|
9
5
|
|
|
10
6
|
set_command_name :'file-copy-request'
|
|
11
7
|
|
|
File without changes
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
require 'fileutils'
|
|
2
|
-
require 'yaml'
|
|
3
|
-
require 'io/console'
|
|
4
|
-
require 'rest_client'
|
|
5
|
-
require 'optparse'
|
|
6
1
|
require 'morpheus/cli/cli_command'
|
|
7
|
-
require 'morpheus/cli/mixins/infrastructure_helper'
|
|
8
|
-
require 'morpheus/logging'
|
|
9
2
|
|
|
10
3
|
class Morpheus::Cli::Groups
|
|
11
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
require 'io/console'
|
|
2
|
-
require 'rest_client'
|
|
3
|
-
require 'optparse'
|
|
4
1
|
require 'morpheus/cli/cli_command'
|
|
5
|
-
require 'morpheus/cli/mixins/logs_helper'
|
|
6
|
-
require 'morpheus/cli/option_types'
|
|
7
|
-
require 'json'
|
|
8
2
|
|
|
9
3
|
class Morpheus::Cli::HealthCommand
|
|
10
4
|
include Morpheus::Cli::CliCommand
|
|
11
5
|
include Morpheus::Cli::LogsHelper
|
|
12
6
|
set_command_name :health
|
|
13
|
-
register_subcommands :get, :alarms, :'get-alarm', :'acknowledge-alarms', :'unacknowledge-alarms', :logs
|
|
7
|
+
register_subcommands :get, :alarms, :'get-alarm', :'acknowledge-alarms', :'unacknowledge-alarms', :logs, :'export-logs'
|
|
14
8
|
|
|
15
9
|
def connect(opts)
|
|
16
10
|
@api_client = establish_remote_appliance_connection(opts)
|
|
@@ -510,17 +504,16 @@ class Morpheus::Cli::HealthCommand
|
|
|
510
504
|
def logs(args)
|
|
511
505
|
options = {}
|
|
512
506
|
params = {}
|
|
513
|
-
start_date, end_date = nil, nil
|
|
514
507
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
515
508
|
opts.banner = subcommand_usage()
|
|
516
509
|
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
|
517
510
|
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
|
518
511
|
end
|
|
519
|
-
opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start timestamp. Default is
|
|
520
|
-
|
|
512
|
+
opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start date timestamp in standard iso8601 format. Default is 24 hours ago.") do |val|
|
|
513
|
+
params['startDate'] = val # parse_time(val).utc.iso8601
|
|
521
514
|
end
|
|
522
|
-
opts.on('--end TIMESTAMP','--end TIMESTAMP', "End timestamp. Default is now.") do |val|
|
|
523
|
-
|
|
515
|
+
opts.on('--end TIMESTAMP','--end TIMESTAMP', "End date timestamp in standard iso8601 format. Default is now.") do |val|
|
|
516
|
+
params['endDate'] = val # parse_time(val).utc.iso8601
|
|
524
517
|
end
|
|
525
518
|
opts.on('-t', '--table', "Format output as a table.") do
|
|
526
519
|
options[:table] = true
|
|
@@ -539,8 +532,8 @@ class Morpheus::Cli::HealthCommand
|
|
|
539
532
|
begin
|
|
540
533
|
# params['startDate'] = start_date.utc.iso8601 if start_date
|
|
541
534
|
# params['endDate'] = end_date.utc.iso8601 if end_date
|
|
542
|
-
params['startMs'] = (start_date.to_i * 1000) if start_date
|
|
543
|
-
params['endMs'] = (end_date.to_i * 1000) if end_date
|
|
535
|
+
# params['startMs'] = (start_date.to_i * 1000) if start_date
|
|
536
|
+
# params['endMs'] = (end_date.to_i * 1000) if end_date
|
|
544
537
|
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
|
545
538
|
params.merge!(parse_list_options(options))
|
|
546
539
|
@health_interface.setopts(options)
|
|
@@ -557,11 +550,11 @@ class Morpheus::Cli::HealthCommand
|
|
|
557
550
|
if params['level']
|
|
558
551
|
subtitles << "Level: #{[params['level']].flatten.join(',')}"
|
|
559
552
|
end
|
|
560
|
-
if
|
|
561
|
-
subtitles << "Start: #{
|
|
553
|
+
if params['startDate']
|
|
554
|
+
subtitles << "Start: #{params['startDate']}"
|
|
562
555
|
end
|
|
563
|
-
if
|
|
564
|
-
subtitles << "End: #{
|
|
556
|
+
if params['endDate']
|
|
557
|
+
subtitles << "End: #{params['endDate']}"
|
|
565
558
|
end
|
|
566
559
|
subtitles += parse_list_subtitles(options)
|
|
567
560
|
print_h1 title, subtitles
|
|
@@ -580,6 +573,98 @@ class Morpheus::Cli::HealthCommand
|
|
|
580
573
|
end
|
|
581
574
|
end
|
|
582
575
|
|
|
576
|
+
def export_logs(args)
|
|
577
|
+
params = {}
|
|
578
|
+
options = {}
|
|
579
|
+
outfile = nil
|
|
580
|
+
do_overwrite = false
|
|
581
|
+
do_mkdir = false
|
|
582
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
583
|
+
opts.banner = subcommand_usage("[file]")
|
|
584
|
+
opts.on('--level VALUE', String, "Log Level. DEBUG,INFO,WARN,ERROR") do |val|
|
|
585
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
|
586
|
+
end
|
|
587
|
+
opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start date timestamp in standard iso8601 format. Default is 24 hours ago.") do |val|
|
|
588
|
+
params['startDate'] = val # parse_time(val).utc.iso8601
|
|
589
|
+
end
|
|
590
|
+
opts.on('--end TIMESTAMP','--end TIMESTAMP', "End date timestamp in standard iso8601 format. Default is now.") do |val|
|
|
591
|
+
params['endDate'] = val # parse_time(val).utc.iso8601
|
|
592
|
+
end
|
|
593
|
+
opts.on( '-f', '--force', "Overwrite existing [file] if it exists." ) do
|
|
594
|
+
do_overwrite = true
|
|
595
|
+
# do_mkdir = true
|
|
596
|
+
end
|
|
597
|
+
opts.on( '-p', '--mkdir', "Create missing directories for [file] if they do not exist." ) do
|
|
598
|
+
do_mkdir = true
|
|
599
|
+
end
|
|
600
|
+
build_common_options(opts, options, [:list, :query, :dry_run, :remote])
|
|
601
|
+
opts.footer = "Export morpheus appliance log." + "\n" +
|
|
602
|
+
"[file] is required. This is local destination for the downloaded file. Example: morpheus.log"
|
|
603
|
+
end
|
|
604
|
+
optparse.parse!(args)
|
|
605
|
+
verify_args!(args:args, optparse:optparse, count: 1)
|
|
606
|
+
connect(options)
|
|
607
|
+
params['level'] = params['level'].collect {|it| it.to_s.upcase }.join('|') if params['level'] # api works with INFO|WARN
|
|
608
|
+
params.merge!(parse_list_options(options))
|
|
609
|
+
|
|
610
|
+
outfile = args[0]
|
|
611
|
+
outfile = File.expand_path(outfile)
|
|
612
|
+
|
|
613
|
+
if Dir.exists?(outfile)
|
|
614
|
+
raise_command_error("[file] is invalid. It is the name of an existing directory: #{outfile}", args, optparse)
|
|
615
|
+
end
|
|
616
|
+
destination_dir = File.dirname(outfile)
|
|
617
|
+
if !Dir.exists?(destination_dir)
|
|
618
|
+
if do_mkdir
|
|
619
|
+
print cyan,"Creating local directory #{destination_dir}",reset,"\n"
|
|
620
|
+
FileUtils.mkdir_p(destination_dir)
|
|
621
|
+
else
|
|
622
|
+
raise_command_error("[file] is invalid. Directory not found: #{destination_dir}", args, optparse)
|
|
623
|
+
end
|
|
624
|
+
end
|
|
625
|
+
if File.exists?(outfile)
|
|
626
|
+
if do_overwrite
|
|
627
|
+
# uhh need to be careful wih the passed filepath here..
|
|
628
|
+
# don't delete, just overwrite.
|
|
629
|
+
# File.delete(outfile)
|
|
630
|
+
else
|
|
631
|
+
raise_command_error("[file] is invalid. File already exists: #{outfile}\nUse -f to overwrite the existing file.", args, optparse)
|
|
632
|
+
end
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
@health_interface.setopts(options)
|
|
636
|
+
if options[:dry_run]
|
|
637
|
+
print_dry_run @health_interface.dry.export_logs(outfile, params)
|
|
638
|
+
return 0
|
|
639
|
+
end
|
|
640
|
+
if !options[:quiet]
|
|
641
|
+
print cyan + "Downloading file #{outfile} ... "
|
|
642
|
+
end
|
|
643
|
+
http_response, bad_body = @health_interface.export_logs(outfile, params)
|
|
644
|
+
# FileUtils.chmod(0600, outfile)
|
|
645
|
+
success = http_response.code.to_i == 200
|
|
646
|
+
if success
|
|
647
|
+
if !options[:quiet]
|
|
648
|
+
print green + "SUCCESS" + reset + " (" + format_bytes(http_response["Content-Length"].to_i).to_s + ")" + "\n"
|
|
649
|
+
end
|
|
650
|
+
# todo: parse default outfile from http_response["Content-Type"]
|
|
651
|
+
return 0
|
|
652
|
+
else
|
|
653
|
+
if !options[:quiet]
|
|
654
|
+
print red + "ERROR" + reset + " HTTP #{http_response.code}" + "\n"
|
|
655
|
+
end
|
|
656
|
+
# F it, just remove a bad result
|
|
657
|
+
if File.exists?(outfile) && File.file?(outfile)
|
|
658
|
+
Morpheus::Logging::DarkPrinter.puts "Deleting bad file download: #{outfile}" if Morpheus::Logging.debug?
|
|
659
|
+
File.delete(outfile)
|
|
660
|
+
end
|
|
661
|
+
if options[:debug]
|
|
662
|
+
puts_error http_response.inspect
|
|
663
|
+
end
|
|
664
|
+
return 1, "download failed"
|
|
665
|
+
end
|
|
666
|
+
end
|
|
667
|
+
|
|
583
668
|
def alarms(args)
|
|
584
669
|
options = {}
|
|
585
670
|
params = {}
|
|
@@ -595,7 +680,7 @@ class Morpheus::Cli::HealthCommand
|
|
|
595
680
|
opts.on('--acknowledged', '--acknowledged', "Filter by acknowledged. By default only open alarms are returned.") do
|
|
596
681
|
params['alarmStatus'] = 'acknowledged'
|
|
597
682
|
end
|
|
598
|
-
opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start timestamp. Default is
|
|
683
|
+
opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start timestamp. Default is 24 hours ago.") do |val|
|
|
599
684
|
start_date = parse_time(val) #.utc.iso8601
|
|
600
685
|
end
|
|
601
686
|
opts.on('--end TIMESTAMP','--end TIMESTAMP', "End timestamp. Default is now.") do |val|
|
|
@@ -1,13 +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/mixins/accounts_helper'
|
|
7
|
-
require 'morpheus/cli/mixins/provisioning_helper'
|
|
8
|
-
require 'morpheus/cli/mixins/logs_helper'
|
|
9
|
-
require 'morpheus/cli/option_types'
|
|
10
|
-
require 'json'
|
|
11
2
|
|
|
12
3
|
class Morpheus::Cli::Hosts
|
|
13
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -553,7 +544,6 @@ class Morpheus::Cli::Hosts
|
|
|
553
544
|
server_columns.delete("Cost") if server['hourlyCost'].to_f == 0
|
|
554
545
|
server_columns.delete("Price") if server['hourlyPrice'].to_f == 0 || server['hourlyPrice'] == server['hourlyCost']
|
|
555
546
|
server_columns.delete("Labels") if server['labels'].nil? || server['labels'].empty?
|
|
556
|
-
server_columns.delete("Tags") if tags.nil? || tags.empty?
|
|
557
547
|
|
|
558
548
|
print_description_list(server_columns, server)
|
|
559
549
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
require 'yaml'
|
|
3
|
-
require 'rest_client'
|
|
4
|
-
require 'optparse'
|
|
5
|
-
require 'filesize'
|
|
6
1
|
require 'morpheus/cli/cli_command'
|
|
7
|
-
require 'morpheus/cli/
|
|
8
|
-
require 'morpheus/cli/
|
|
9
|
-
require 'morpheus/cli/preseed_scripts_command'
|
|
2
|
+
# require 'morpheus/cli/commands/boot_scripts_command'
|
|
3
|
+
# require 'morpheus/cli/commands/preseed_scripts_command'
|
|
10
4
|
|
|
11
5
|
class Morpheus::Cli::ImageBuilderCommand
|
|
12
6
|
include Morpheus::Cli::CliCommand
|