morpheus-cli 5.3.3 → 5.4.2
Sign up to get free protection for your applications and to get access to all the features.
- 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,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/mixins/infrastructure_helper'
|
7
|
-
require 'morpheus/cli/mixins/provisioning_helper'
|
8
|
-
require 'morpheus/cli/option_types'
|
9
2
|
|
10
3
|
class Morpheus::Cli::Clouds
|
11
4
|
include Morpheus::Cli::CliCommand
|
@@ -27,8 +20,6 @@ class Morpheus::Cli::Clouds
|
|
27
20
|
@clouds_interface = @api_client.clouds
|
28
21
|
@groups_interface = @api_client.groups
|
29
22
|
@active_group_id = Morpheus::Cli::Groups.active_groups[@appliance_name]
|
30
|
-
# preload stuff
|
31
|
-
get_available_cloud_types()
|
32
23
|
end
|
33
24
|
|
34
25
|
def handle(args)
|
@@ -134,38 +125,36 @@ class Morpheus::Cli::Clouds
|
|
134
125
|
|
135
126
|
def get(args)
|
136
127
|
options = {}
|
128
|
+
params = {}
|
137
129
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
138
130
|
opts.banner = subcommand_usage("[name]")
|
139
|
-
|
131
|
+
build_standard_list_options(opts, options)
|
140
132
|
opts.footer = "Get details about a cloud.\n" +
|
141
133
|
"[name] is required. This is the name or id of a cloud."
|
142
134
|
end
|
143
135
|
optparse.parse!(args)
|
144
|
-
|
145
|
-
puts optparse
|
146
|
-
exit 1
|
147
|
-
end
|
136
|
+
verify_args!(args:args, optparse:optparse, min:1)
|
148
137
|
connect(options)
|
138
|
+
params.merge!(parse_query_options(options))
|
149
139
|
id_list = parse_id_list(args)
|
150
140
|
return run_command_for_each_arg(id_list) do |arg|
|
151
|
-
_get(arg, options)
|
141
|
+
_get(arg, params, options)
|
152
142
|
end
|
153
143
|
end
|
154
144
|
|
155
|
-
def _get(
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
json_response = @clouds_interface.get(cloud['id'])
|
145
|
+
def _get(id, params, options={})
|
146
|
+
cloud = nil
|
147
|
+
if id.to_s !~ /\A\d{1,}\Z/
|
148
|
+
cloud = find_cloud_by_name_or_id(id)
|
149
|
+
id = cloud['id']
|
150
|
+
end
|
151
|
+
@clouds_interface.setopts(options)
|
152
|
+
if options[:dry_run]
|
153
|
+
print_dry_run @clouds_interface.dry.get(id.to_i, params)
|
154
|
+
return
|
155
|
+
end
|
156
|
+
json_response = @clouds_interface.get(id, params)
|
157
|
+
render_response(json_response, options, 'zone') do
|
169
158
|
cloud = json_response['zone']
|
170
159
|
cloud_stats = cloud['stats']
|
171
160
|
# serverCounts moved to zone.stats.serverCounts
|
@@ -175,17 +164,6 @@ class Morpheus::Cli::Clouds
|
|
175
164
|
else
|
176
165
|
server_counts = json_response['serverCounts'] # legacy
|
177
166
|
end
|
178
|
-
if options[:json]
|
179
|
-
puts as_json(json_response, options, 'zone')
|
180
|
-
return 0
|
181
|
-
elsif options[:yaml]
|
182
|
-
puts as_yaml(json_response, options, 'zone')
|
183
|
-
return 0
|
184
|
-
end
|
185
|
-
if options[:csv]
|
186
|
-
puts records_as_csv([json_response['zone']], options)
|
187
|
-
return 0
|
188
|
-
end
|
189
167
|
cloud_type = cloud_type_for_id(cloud['zoneTypeId'])
|
190
168
|
print_h1 "Cloud Details"
|
191
169
|
print cyan
|
@@ -195,6 +173,7 @@ class Morpheus::Cli::Clouds
|
|
195
173
|
"Type" => lambda {|it| cloud_type ? cloud_type['name'] : '' },
|
196
174
|
"Code" => 'code',
|
197
175
|
"Location" => 'location',
|
176
|
+
"Region Code" => 'regionCode',
|
198
177
|
"Visibility" => lambda {|it| it['visibility'].to_s.capitalize },
|
199
178
|
"Groups" => lambda {|it| it['groups'].collect {|g| g.instance_of?(Hash) ? g['name'] : g.to_s }.join(', ') },
|
200
179
|
#"Owner" => lambda {|it| it['owner'].instance_of?(Hash) ? it['owner']['name'] : it['ownerId'] },
|
@@ -214,14 +193,9 @@ class Morpheus::Cli::Clouds
|
|
214
193
|
print "Unmanaged: #{server_counts['unmanaged']}".center(20)
|
215
194
|
print "\n"
|
216
195
|
end
|
217
|
-
|
218
196
|
print reset,"\n"
|
219
|
-
|
220
|
-
#puts instance
|
221
|
-
rescue RestClient::Exception => e
|
222
|
-
print_rest_exception(e, options)
|
223
|
-
exit 1
|
224
197
|
end
|
198
|
+
return 0, nil
|
225
199
|
end
|
226
200
|
|
227
201
|
def add(args)
|
@@ -954,13 +928,14 @@ class Morpheus::Cli::Clouds
|
|
954
928
|
name: cloud['name'],
|
955
929
|
type: cloud_type ? cloud_type['name'] : '',
|
956
930
|
location: cloud['location'],
|
931
|
+
"REGION CODE": cloud['regionCode'],
|
957
932
|
groups: (cloud['groups'] || []).collect {|it| it.instance_of?(Hash) ? it['name'] : it.to_s }.join(', '),
|
958
933
|
servers: cloud['serverCount'],
|
959
934
|
status: format_cloud_status(cloud)
|
960
935
|
}
|
961
936
|
end
|
962
937
|
columns = [
|
963
|
-
:id, :name, :type, :location, :groups, :servers, :status
|
938
|
+
:id, :name, :type, :location, "REGION CODE", :groups, :servers, :status
|
964
939
|
]
|
965
940
|
print as_pretty_table(rows, columns, opts)
|
966
941
|
end
|
@@ -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
|
@@ -464,6 +458,10 @@ class Morpheus::Cli::Clusters
|
|
464
458
|
|
465
459
|
cluster_payload['type'] = cluster_type['code'] # {'id' => cluster_type['id']}
|
466
460
|
|
461
|
+
# Group / Site
|
462
|
+
group = load_group(cluster_type['code'], options)
|
463
|
+
cluster_payload['group'] = {'id' => group['id']}
|
464
|
+
|
467
465
|
# Cluster Name
|
468
466
|
if args.empty? && options[:no_prompt]
|
469
467
|
print_red_alert "No cluster name provided"
|
@@ -520,10 +518,6 @@ class Morpheus::Cli::Clusters
|
|
520
518
|
|
521
519
|
server_payload['tags'] = tags if tags
|
522
520
|
|
523
|
-
# Group / Site
|
524
|
-
group = load_group(options)
|
525
|
-
cluster_payload['group'] = {'id' => group['id']}
|
526
|
-
|
527
521
|
# Cloud / Zone
|
528
522
|
cloud_id = nil
|
529
523
|
cloud = options[:cloud] ? find_cloud_by_name_or_id_for_provisioning(group['id'], options[:cloud]) : nil
|
@@ -532,7 +526,7 @@ class Morpheus::Cli::Clusters
|
|
532
526
|
cloud = @clouds_interface.get(cloud['id'])['zone']
|
533
527
|
cloud_id = cloud['id']
|
534
528
|
else
|
535
|
-
available_clouds = get_available_clouds(group['id'])
|
529
|
+
available_clouds = get_available_clouds(group['id'], {groupType: cluster_payload['type']})
|
536
530
|
|
537
531
|
if available_clouds.empty?
|
538
532
|
print_red_alert "Group #{group['name']} has no available clouds"
|
@@ -562,12 +556,12 @@ class Morpheus::Cli::Clusters
|
|
562
556
|
end
|
563
557
|
end
|
564
558
|
|
565
|
-
cluster_payload['layout'] = {id
|
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
563
|
|
570
|
-
api_params = {zoneId: cloud['id'], siteId: group['id'], layoutId: layout['id'], groupTypeId: cluster_type['id'], provisionTypeId: provision_type['id']}
|
564
|
+
api_params = {zoneId: cloud['id'], siteId: group['id'], layoutId: layout['id'], groupTypeId: cluster_type['id'], provisionType: provision_type['code'], provisionTypeId: provision_type['id']}
|
571
565
|
|
572
566
|
# Controller type
|
573
567
|
server_types = @server_types_interface.list({max:1, computeTypeId: cluster_type['controllerTypes'].first['id'], zoneTypeId: cloud['zoneType']['id'], useZoneProvisionTypes: true})['serverTypes']
|
@@ -627,11 +621,15 @@ class Morpheus::Cli::Clusters
|
|
627
621
|
# Visibility
|
628
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'])
|
629
623
|
|
624
|
+
# Layout template options
|
625
|
+
cluster_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(load_layout_options(cluster_payload), options[:options], @api_client, api_params, options[:no_prompt], true))
|
626
|
+
|
627
|
+
# Server options
|
630
628
|
server_payload.deep_merge!(Morpheus::Cli::OptionTypes.prompt(option_type_list, options[:options], @api_client, api_params, options[:no_prompt], true))
|
631
629
|
|
632
630
|
# Worker count
|
633
631
|
default_node_count = layout['computeServers'] ? (layout['computeServers'].find {|it| it['nodeType'] == 'worker'} || {'nodeCount' => 3})['nodeCount'] : 3
|
634
|
-
server_payload['config']['nodeCount'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => "config.nodeCount", 'type' => 'number', 'fieldLabel' => "#{
|
632
|
+
server_payload['config']['nodeCount'] = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => "config.nodeCount", 'type' => 'number', 'fieldLabel' => "#{['docker', 'kvm-cluster'].include?(cluster_type['code']) ? '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']
|
635
633
|
|
636
634
|
# Create User
|
637
635
|
if !options[:createUser].nil?
|
@@ -3671,7 +3669,7 @@ class Morpheus::Cli::Clusters
|
|
3671
3669
|
@clouds_interface.cloud_type(zone_type_id)['zoneType']['provisionTypes'].first rescue nil
|
3672
3670
|
end
|
3673
3671
|
|
3674
|
-
def load_group(options)
|
3672
|
+
def load_group(group_type, options)
|
3675
3673
|
# Group / Site
|
3676
3674
|
group_id = nil
|
3677
3675
|
group = options[:group] ? find_group_by_name_or_id_for_provisioning(options[:group]) : nil
|
@@ -3682,15 +3680,13 @@ class Morpheus::Cli::Clusters
|
|
3682
3680
|
if @active_group_id
|
3683
3681
|
group_id = @active_group_id
|
3684
3682
|
else
|
3685
|
-
available_groups = get_available_groups
|
3683
|
+
available_groups = get_available_groups({groupType: group_type})
|
3686
3684
|
|
3687
3685
|
if available_groups.empty?
|
3688
3686
|
print_red_alert "No available groups"
|
3689
3687
|
exit 1
|
3690
|
-
|
3688
|
+
else available_groups.count > 1 && !options[:no_prompt]
|
3691
3689
|
group_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'group', 'type' => 'select', 'fieldLabel' => 'Group', 'selectOptions' => available_groups, 'required' => true, 'description' => 'Select Group.'}],options[:options],@api_client,{})['group']
|
3692
|
-
else
|
3693
|
-
group_id = available_groups.first['id']
|
3694
3690
|
end
|
3695
3691
|
end
|
3696
3692
|
end
|
@@ -3932,4 +3928,27 @@ class Morpheus::Cli::Clusters
|
|
3932
3928
|
]
|
3933
3929
|
end
|
3934
3930
|
|
3931
|
+
def load_layout_options(cluster)
|
3932
|
+
(@api_client.options.options_for_source('computeTypeLayoutParameters', {layoutId: cluster['layout']['id']})['data'] || []).collect do |it|
|
3933
|
+
it['fieldName'] = it['name']
|
3934
|
+
it['fieldLabel'] = it['displayName']
|
3935
|
+
it['fieldContext'] = 'config.templateParameter'
|
3936
|
+
if it['type'] == 'ServicePlan'
|
3937
|
+
it['optionSource'] = 'servicePlans'
|
3938
|
+
it['type'] = 'select'
|
3939
|
+
it['params'] = {:provisionType => '', :zoneId => '', :siteId => '', :resourcePoolId => ''}
|
3940
|
+
it['params'][:provisionType] = 'azure' if it['azureServicePlanType']
|
3941
|
+
elsif it['type'] == 'Subnet'
|
3942
|
+
it['optionSource'] = 'networks'
|
3943
|
+
it['type'] = 'select'
|
3944
|
+
it['params'] = {:siteId => '', :instanceId => '', :serverId => '', :zonePoolId => '', :zoneRegionId => '', :zoneId => '', :provisionType => ''}
|
3945
|
+
if cluster['type'] == 'aks-cluster'
|
3946
|
+
it['params'][:provisionType] = 'azure'
|
3947
|
+
end
|
3948
|
+
else
|
3949
|
+
it['type'] = 'text'
|
3950
|
+
end
|
3951
|
+
it
|
3952
|
+
end
|
3953
|
+
end
|
3935
3954
|
end
|
@@ -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
|