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
|
@@ -75,7 +75,7 @@ class Morpheus::Cli::AccessTokenCommand
|
|
|
75
75
|
"Refresh Token" => lambda {|wallet| wallet['refresh_token'] },
|
|
76
76
|
"Login Date" => lambda {|wallet| format_local_dt(wallet['login_date']) },
|
|
77
77
|
"Expire Date" => lambda {|wallet| wallet['expire_date'] ? format_local_dt(wallet['expire_date']) : "" },
|
|
78
|
-
|
|
78
|
+
"Remote" => lambda {|wallet| display_appliance(@appliance_name, @appliance_url) },
|
|
79
79
|
}
|
|
80
80
|
print cyan
|
|
81
81
|
puts as_description_list(@wallet, description_cols)
|
|
@@ -1,12 +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/accounts_helper'
|
|
8
|
-
require 'morpheus/cli/mixins/infrastructure_helper'
|
|
9
|
-
require 'morpheus/logging'
|
|
10
2
|
|
|
11
3
|
class Morpheus::Cli::AccountGroupsCommand
|
|
12
4
|
include Morpheus::Cli::CliCommand
|
|
File without changes
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
require 'optparse'
|
|
2
1
|
require 'morpheus/cli/cli_command'
|
|
3
|
-
require 'morpheus/cli/shell'
|
|
4
|
-
require 'json'
|
|
5
2
|
|
|
6
3
|
# This command allows the creation of an alias
|
|
7
4
|
# these aliases are stored in the $MORPHEUS_CLI_HOME/.morpheusrc
|
|
@@ -273,7 +270,7 @@ EOT
|
|
|
273
270
|
out << "\n"
|
|
274
271
|
out << cyan
|
|
275
272
|
out << as_pretty_table(my_aliases, alias_columns, {:border_style => :thin}.merge(options))
|
|
276
|
-
out << format_results_pagination({size
|
|
273
|
+
out << format_results_pagination({'size' => my_aliases.size, 'total' => my_aliases.size.to_i})
|
|
277
274
|
out << reset
|
|
278
275
|
out << "\n"
|
|
279
276
|
end
|
data/lib/morpheus/cli/{appliance_settings_command.rb → commands/appliance_settings_command.rb}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -1,13 +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/accounts_helper'
|
|
8
|
-
require 'morpheus/cli/mixins/provisioning_helper'
|
|
9
|
-
require 'morpheus/cli/mixins/processes_helper'
|
|
10
|
-
require 'morpheus/cli/mixins/logs_helper'
|
|
11
2
|
|
|
12
3
|
class Morpheus::Cli::Apps
|
|
13
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -19,9 +10,7 @@ class Morpheus::Cli::Apps
|
|
|
19
10
|
set_command_name :apps
|
|
20
11
|
set_command_description "View and manage apps."
|
|
21
12
|
register_subcommands :list, :count, :get, :view, :add, :update, :remove, :cancel_removal, :add_instance, :remove_instance, :logs, :security_groups, :apply_security_groups, :history
|
|
22
|
-
register_subcommands :
|
|
23
|
-
register_subcommands :apply
|
|
24
|
-
register_subcommands :refresh
|
|
13
|
+
register_subcommands :refresh, :apply
|
|
25
14
|
register_subcommands :stop, :start, :restart
|
|
26
15
|
register_subcommands :wiki, :update_wiki
|
|
27
16
|
#register_subcommands :firewall_disable, :firewall_enable
|
|
@@ -36,7 +25,7 @@ class Morpheus::Cli::Apps
|
|
|
36
25
|
def connect(opts)
|
|
37
26
|
@api_client = establish_remote_appliance_connection(opts)
|
|
38
27
|
@accounts_interface = @api_client.accounts
|
|
39
|
-
@
|
|
28
|
+
@account_users_interface = @api_client.account_users
|
|
40
29
|
@apps_interface = @api_client.apps
|
|
41
30
|
@blueprints_interface = @api_client.blueprints
|
|
42
31
|
@instance_types_interface = @api_client.instance_types
|
|
@@ -901,9 +890,7 @@ This is only supported by certain types of apps.
|
|
|
901
890
|
EOT
|
|
902
891
|
end
|
|
903
892
|
optparse.parse!(args)
|
|
904
|
-
|
|
905
|
-
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(', ')}\n#{optparse}"
|
|
906
|
-
end
|
|
893
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
|
907
894
|
connect(options)
|
|
908
895
|
|
|
909
896
|
begin
|
|
@@ -928,65 +915,11 @@ EOT
|
|
|
928
915
|
return
|
|
929
916
|
end
|
|
930
917
|
json_response = @apps_interface.refresh(app["id"], params, payload)
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
return get([app['id']] + (options[:remote] ? ["-r",options[:remote]] : []))
|
|
935
|
-
rescue RestClient::Exception => e
|
|
936
|
-
print_rest_exception(e, options)
|
|
937
|
-
exit 1
|
|
938
|
-
end
|
|
939
|
-
end
|
|
940
|
-
|
|
941
|
-
def prepare_apply(args)
|
|
942
|
-
params, payload, options = {}, {}, {}
|
|
943
|
-
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
944
|
-
opts.banner = subcommand_usage("[app] [options]")
|
|
945
|
-
build_standard_update_options(opts, options, [:auto_confirm])
|
|
946
|
-
opts.footer = <<-EOT
|
|
947
|
-
Prepare to apply an app.
|
|
948
|
-
[app] is required. This is the name or id of an app.
|
|
949
|
-
Template parameter values can be applied with -O templateParameter.foo=bar
|
|
950
|
-
This only prints the app configuration that would be applied.
|
|
951
|
-
It does not make any updates.
|
|
952
|
-
This is only supported by certain types of apps.
|
|
953
|
-
EOT
|
|
954
|
-
end
|
|
955
|
-
optparse.parse!(args)
|
|
956
|
-
if args.count != 1
|
|
957
|
-
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(', ')}\n#{optparse}"
|
|
958
|
-
end
|
|
959
|
-
connect(options)
|
|
960
|
-
|
|
961
|
-
begin
|
|
962
|
-
app = find_app_by_name_or_id(args[0])
|
|
963
|
-
return 1 if app.nil?
|
|
964
|
-
# construct request
|
|
965
|
-
params.merge!(parse_query_options(options))
|
|
966
|
-
payload = {}
|
|
967
|
-
if options[:payload]
|
|
968
|
-
payload = options[:payload]
|
|
969
|
-
payload.deep_merge!(parse_passed_options(options))
|
|
970
|
-
else
|
|
971
|
-
payload.deep_merge!(parse_passed_options(options))
|
|
972
|
-
# raise_command_error "Specify at least one option to update.\n#{optparse}" if payload.empty?
|
|
918
|
+
render_response(json_response, options) do
|
|
919
|
+
print_green_success "Refreshing app #{app['name']}"
|
|
920
|
+
# return _get(app['id'], options)
|
|
973
921
|
end
|
|
974
|
-
|
|
975
|
-
if options[:dry_run]
|
|
976
|
-
print_dry_run @apps_interface.dry.prepare_apply(app["id"], params, payload)
|
|
977
|
-
return
|
|
978
|
-
end
|
|
979
|
-
json_response = @apps_interface.prepare_apply(app["id"], params, payload)
|
|
980
|
-
render_result = render_with_format(json_response, options)
|
|
981
|
-
return 0 if render_result
|
|
982
|
-
# print_green_success "Prepared to apply app: #{app['name']}"
|
|
983
|
-
print_h1 "Prepared App: #{app['name']}"
|
|
984
|
-
app_config = json_response['data']
|
|
985
|
-
# app_config = json_response if app_config.nil?
|
|
986
|
-
puts as_yaml(app_config, options)
|
|
987
|
-
#return get([app['id']] + (options[:remote] ? ["-r",options[:remote]] : []))
|
|
988
|
-
print "\n", reset
|
|
989
|
-
return 0
|
|
922
|
+
return 0, nil
|
|
990
923
|
rescue RestClient::Exception => e
|
|
991
924
|
print_rest_exception(e, options)
|
|
992
925
|
exit 1
|
|
@@ -1001,17 +934,11 @@ EOT
|
|
|
1001
934
|
opts.footer = <<-EOT
|
|
1002
935
|
Apply an app.
|
|
1003
936
|
[app] is required. This is the name or id of an app.
|
|
1004
|
-
|
|
1005
|
-
This is a way to apply an app with new configuration parameters to an app.
|
|
1006
|
-
This prints the app configuration that would be applied.
|
|
1007
|
-
It does not make any updates.
|
|
1008
|
-
This is only supported by certain types of apps.
|
|
937
|
+
This is only supported by certain types of apps such as terraform.
|
|
1009
938
|
EOT
|
|
1010
939
|
end
|
|
1011
940
|
optparse.parse!(args)
|
|
1012
|
-
|
|
1013
|
-
raise_command_error "wrong number of arguments, expected 1 and got (#{args.count}) #{args.join(', ')}\n#{optparse}"
|
|
1014
|
-
end
|
|
941
|
+
verify_args!(args:args, optparse:optparse, count:1)
|
|
1015
942
|
connect(options)
|
|
1016
943
|
|
|
1017
944
|
begin
|
|
@@ -1036,11 +963,11 @@ EOT
|
|
|
1036
963
|
return
|
|
1037
964
|
end
|
|
1038
965
|
json_response = @apps_interface.apply(app["id"], params, payload)
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
return 0
|
|
966
|
+
render_response(json_response, options) do
|
|
967
|
+
print_green_success "Applying app #{app['name']}"
|
|
968
|
+
# return _get(app['id'], options)
|
|
969
|
+
end
|
|
970
|
+
return 0, nil
|
|
1044
971
|
rescue RestClient::Exception => e
|
|
1045
972
|
print_rest_exception(e, options)
|
|
1046
973
|
exit 1
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::Audit
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::LogsHelper
|
|
6
|
+
include Morpheus::Cli::RestCommand
|
|
7
|
+
include Morpheus::Cli::OptionSourceHelper
|
|
8
|
+
|
|
9
|
+
set_command_description "View audit log records."
|
|
10
|
+
set_command_name :'audit'
|
|
11
|
+
register_subcommands :list, :get
|
|
12
|
+
|
|
13
|
+
# audit is not published yet
|
|
14
|
+
set_command_hidden
|
|
15
|
+
|
|
16
|
+
# RestCommand settings
|
|
17
|
+
|
|
18
|
+
# interfaces
|
|
19
|
+
register_interfaces :audit
|
|
20
|
+
set_rest_interface_name :audit
|
|
21
|
+
|
|
22
|
+
# resource name is "Audit Log"
|
|
23
|
+
set_rest_name :audit_log
|
|
24
|
+
|
|
25
|
+
# display argument as [id] instead of [audit log]
|
|
26
|
+
set_rest_has_name false
|
|
27
|
+
set_rest_arg "id"
|
|
28
|
+
|
|
29
|
+
# def connect(opts)
|
|
30
|
+
# @api_client = establish_remote_appliance_connection(opts)
|
|
31
|
+
# @audit_interface = @api_client.audit # @api_client.rest("audit")
|
|
32
|
+
# end
|
|
33
|
+
|
|
34
|
+
# def handle(args)
|
|
35
|
+
# handle_subcommand(args)
|
|
36
|
+
# end
|
|
37
|
+
|
|
38
|
+
def list(args)
|
|
39
|
+
options = {}
|
|
40
|
+
params = {}
|
|
41
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
42
|
+
opts.banner = subcommand_usage("[search]")
|
|
43
|
+
opts.on('--user USER', String, "Filter by User Username or ID") do |val|
|
|
44
|
+
params['user'] = params['user'] ? [params['user'], val].flatten : [val]
|
|
45
|
+
end
|
|
46
|
+
opts.on('--level VALUE', String, "Log Level. DEBUG|INFO|WARN|ERROR") do |val|
|
|
47
|
+
params['level'] = params['level'] ? [params['level'], val].flatten : [val]
|
|
48
|
+
end
|
|
49
|
+
opts.on('--start TIMESTAMP','--start TIMESTAMP', "Start date timestamp in standard iso8601 format.") do |val|
|
|
50
|
+
params['startDate'] = val # parse_time(val).utc.iso8601
|
|
51
|
+
end
|
|
52
|
+
opts.on('--end TIMESTAMP','--end TIMESTAMP', "End date timestamp in standard iso8601 format.") do |val|
|
|
53
|
+
params['endDate'] = val # parse_time(val).utc.iso8601
|
|
54
|
+
end
|
|
55
|
+
build_standard_list_options(opts, options)
|
|
56
|
+
opts.footer = "List audit logs records."
|
|
57
|
+
end
|
|
58
|
+
optparse.parse!(args)
|
|
59
|
+
if args.count > 0
|
|
60
|
+
options[:phrase] = args.join(" ")
|
|
61
|
+
end
|
|
62
|
+
connect(options)
|
|
63
|
+
params.merge!(parse_list_options(options))
|
|
64
|
+
# parse --user id,name
|
|
65
|
+
if params['user']
|
|
66
|
+
user_ids = parse_user_id_list(params['user'])
|
|
67
|
+
return 1 if user_ids.nil?
|
|
68
|
+
params['user'] = user_ids
|
|
69
|
+
end
|
|
70
|
+
# api works with level=INFO|WARN
|
|
71
|
+
if params['level']
|
|
72
|
+
params['level'] = [params['level']].flatten.collect {|it| it.to_s.upcase }.join('|')
|
|
73
|
+
end
|
|
74
|
+
# could find_by_name_or_id for params['servers'] and params['containers']
|
|
75
|
+
@audit_interface.setopts(options)
|
|
76
|
+
if options[:dry_run]
|
|
77
|
+
print_dry_run @audit_interface.dry.list(params)
|
|
78
|
+
return
|
|
79
|
+
end
|
|
80
|
+
json_response = @audit_interface.list(params)
|
|
81
|
+
|
|
82
|
+
render_response(json_response, options, rest_list_key) do
|
|
83
|
+
records = json_response[rest_list_key]
|
|
84
|
+
print_h1 "Morpheus Audit Log", parse_list_subtitles(options), options
|
|
85
|
+
if records.nil? || records.empty?
|
|
86
|
+
print cyan,"No #{rest_label_plural.downcase} found.",reset,"\n"
|
|
87
|
+
else
|
|
88
|
+
print as_pretty_table(records, rest_list_column_definitions(options).upcase_keys!, options)
|
|
89
|
+
print_results_pagination(json_response) if json_response['meta']
|
|
90
|
+
end
|
|
91
|
+
print reset,"\n"
|
|
92
|
+
end
|
|
93
|
+
return 0, nil
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
protected
|
|
97
|
+
|
|
98
|
+
# custom rendering to print Message below description list
|
|
99
|
+
def render_response_for_get(json_response, options)
|
|
100
|
+
render_response(json_response, options, rest_object_key) do
|
|
101
|
+
record = json_response[rest_object_key]
|
|
102
|
+
print_h1 rest_label, [], options
|
|
103
|
+
print cyan
|
|
104
|
+
print_description_list(rest_column_definitions(options), record, options)
|
|
105
|
+
# show log message settings...
|
|
106
|
+
print_h2 "Message", options
|
|
107
|
+
print cyan
|
|
108
|
+
puts record['message']
|
|
109
|
+
print reset,"\n"
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def audit_log_object_key
|
|
114
|
+
"auditLog"
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def audit_log_list_key
|
|
118
|
+
"auditLogs"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def audit_log_list_column_definitions(options={})
|
|
122
|
+
{
|
|
123
|
+
"ID" => 'id',
|
|
124
|
+
"Level" => lambda {|it| format_log_level(it['level']) },
|
|
125
|
+
"Message" => {display_method:'message', max_width: (options[:wrap] ? nil : 75)},
|
|
126
|
+
"Event Type" => 'eventType',
|
|
127
|
+
"Object" => lambda {|it| "#{it['objectClass']} #{it['objectId']}".strip },
|
|
128
|
+
# "Object Type" => 'objectClass',
|
|
129
|
+
# "Object ID" => 'objectId',
|
|
130
|
+
"User" => lambda {|it|
|
|
131
|
+
if it['actualUser'] && it['user'] && it['actualUser']['username'] != it['user']['username']
|
|
132
|
+
it['user']['username'] + '(' + it['actualUser']['username'].to_s + ')'
|
|
133
|
+
elsif it['user']
|
|
134
|
+
it['user']['username']
|
|
135
|
+
else
|
|
136
|
+
# system or deleted user maybe?
|
|
137
|
+
end
|
|
138
|
+
},
|
|
139
|
+
# "Tenant" => lambda {|it| it['account'] ? it['account']['name'] : '' },
|
|
140
|
+
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
|
141
|
+
}
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def audit_log_column_definitions(options={})
|
|
145
|
+
{
|
|
146
|
+
"ID" => 'id',
|
|
147
|
+
"Level" => lambda {|it| format_log_level(it['level']) },
|
|
148
|
+
#"Message" => 'message',
|
|
149
|
+
"Event Type" => 'eventType',
|
|
150
|
+
"Object Type" => 'objectClass',
|
|
151
|
+
"Object ID" => 'objectId',
|
|
152
|
+
"User" => lambda {|it|
|
|
153
|
+
if it['actualUser'] && it['user'] && it['actualUser']['username'] != it['user']['username']
|
|
154
|
+
it['user']['username'] + '(' + it['actualUser']['username'].to_s + ')'
|
|
155
|
+
elsif it['user']
|
|
156
|
+
it['user']['username']
|
|
157
|
+
else
|
|
158
|
+
# system or deleted user maybe?
|
|
159
|
+
end
|
|
160
|
+
},
|
|
161
|
+
# "Tenant" => lambda {|it| it['account'] ? it['account']['name'] : '' },
|
|
162
|
+
"Created" => lambda {|it| format_local_dt(it['dateCreated']) },
|
|
163
|
+
}
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def find_audit_log_by_name_or_id(val)
|
|
167
|
+
return find_audit_log_by_id(val)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def find_audit_log_by_id(id)
|
|
171
|
+
begin
|
|
172
|
+
json_response = @audit_interface.get(id)
|
|
173
|
+
return json_response[audit_log_object_key]
|
|
174
|
+
rescue RestClient::Exception => e
|
|
175
|
+
if e.response && e.response.code == 404
|
|
176
|
+
print_red_alert "Audit Log not found by id #{id}"
|
|
177
|
+
return nil
|
|
178
|
+
else
|
|
179
|
+
raise e
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def find_audit_log_by_name(name)
|
|
185
|
+
raise_command_error "finding audit log by name not supported"
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -36,7 +36,7 @@ class Morpheus::Cli::BlueprintsCommand
|
|
|
36
36
|
@options_interface = @api_client.options
|
|
37
37
|
@active_group_id = Morpheus::Cli::Groups.active_groups[@appliance_name]
|
|
38
38
|
@clouds_interface = @api_client.clouds
|
|
39
|
-
@
|
|
39
|
+
@account_users_interface = @api_client.account_users
|
|
40
40
|
@library_layouts_interface = @api_client.library_layouts
|
|
41
41
|
end
|
|
42
42
|
|
|
File without changes
|
|
File without changes
|
data/lib/morpheus/cli/{catalog_item_types_command.rb → commands/catalog_item_types_command.rb}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
require 'morpheus/cli/cli_command'
|
|
2
|
+
|
|
3
|
+
class Morpheus::Cli::ChangePasswordCommand
|
|
4
|
+
include Morpheus::Cli::CliCommand
|
|
5
|
+
include Morpheus::Cli::AccountsHelper
|
|
6
|
+
|
|
7
|
+
set_command_name :passwd
|
|
8
|
+
|
|
9
|
+
def connect(opts)
|
|
10
|
+
@api_client = establish_remote_appliance_connection(opts)
|
|
11
|
+
@whoami_interface = @api_client.whoami
|
|
12
|
+
@account_users_interface = @api_client.account_users
|
|
13
|
+
@accounts_interface = @api_client.accounts
|
|
14
|
+
@roles_interface = @api_client.roles
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def handle(args)
|
|
18
|
+
change_password(args)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def change_password(args)
|
|
22
|
+
options = {}
|
|
23
|
+
username = nil
|
|
24
|
+
new_password = nil
|
|
25
|
+
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
26
|
+
opts.banner = subcommand_usage("[username] [options]")
|
|
27
|
+
opts.on('--username USERNAME', String, "Username. Default is your own.") do |val|
|
|
28
|
+
username = val
|
|
29
|
+
end
|
|
30
|
+
opts.on('--password VALUE', String, "New password") do |val|
|
|
31
|
+
new_password = val
|
|
32
|
+
end
|
|
33
|
+
build_common_options(opts, options, [:account, :options, :json, :dry_run, :remote, :quiet, :auto_confirm], [:username,:password])
|
|
34
|
+
opts.footer = "Change your password or the password of another user.\n" +
|
|
35
|
+
"[username] is optional. This is the username of the user to update. Default is your own.\n" +
|
|
36
|
+
"Be careful with this command, the default behavior is to update your own password."
|
|
37
|
+
end
|
|
38
|
+
optparse.parse!(args)
|
|
39
|
+
|
|
40
|
+
if args.count > 1
|
|
41
|
+
print_error Morpheus::Terminal.angry_prompt
|
|
42
|
+
puts_error "wrong number of arguments, expected 0-1 and got #{args.count} #{args}\n#{optparse}"
|
|
43
|
+
return 1
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
connect(options)
|
|
47
|
+
@current_remote = @appliance_name ? ::Morpheus::Cli::Remote.load_remote(@appliance_name) : ::Morpheus::Cli::Remote.load_active_remote()
|
|
48
|
+
|
|
49
|
+
if args[0]
|
|
50
|
+
username = args[0]
|
|
51
|
+
end
|
|
52
|
+
if username.nil?
|
|
53
|
+
if !@current_remote
|
|
54
|
+
raise_command_error "No current appliance, see `remote use`."
|
|
55
|
+
end
|
|
56
|
+
if !@current_remote[:username]
|
|
57
|
+
raise_command_error "You are not currently logged in to #{display_appliance(@current_remote[:name], @current_remote[:url])}"
|
|
58
|
+
end
|
|
59
|
+
username = @current_remote[:username]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
account = find_account_from_options(options)
|
|
63
|
+
account_id = account ? account['id'] : nil
|
|
64
|
+
|
|
65
|
+
user = find_user_by_username_or_id(account_id, username)
|
|
66
|
+
return 1 if user.nil?
|
|
67
|
+
|
|
68
|
+
if @current_remote && @current_remote[:username] == username
|
|
69
|
+
if !options[:quiet]
|
|
70
|
+
if options[:dry_run]
|
|
71
|
+
print cyan,bold, "DRY RUN. This is just a dry run, the password is not being updated.",reset,"\n"
|
|
72
|
+
else
|
|
73
|
+
print cyan,bold, "WARNING! You are about to update your own password!",reset,"\n"
|
|
74
|
+
print yellow,bold,"WARNING! You are about to update your own password!",reset,"\n"
|
|
75
|
+
print reset,bold, "WARNING! You are about to update your own password!",reset,"\n"
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if !options[:quiet]
|
|
81
|
+
print cyan, "Changing password for #{user['username']}", reset, "\n"
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if new_password.nil? && options[:options]['password']
|
|
85
|
+
new_password = options[:options]['password']
|
|
86
|
+
end
|
|
87
|
+
if new_password.nil?
|
|
88
|
+
password_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'password', 'fieldLabel' => 'New Password', 'type' => 'password', 'required' => true}], options[:options], @api_client)
|
|
89
|
+
new_password = password_prompt['password']
|
|
90
|
+
confirm_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'passwordConfirmation', 'fieldLabel' => 'Confirm Password', 'type' => 'password', 'required' => true}], options[:options], @api_client)
|
|
91
|
+
confirm_password = confirm_prompt['passwordConfirmation']
|
|
92
|
+
if confirm_password != new_password
|
|
93
|
+
print_red_alert "Confirm password did not match."
|
|
94
|
+
return 1
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
if new_password.nil? || new_password.empty?
|
|
99
|
+
print_red_alert "A new password is required"
|
|
100
|
+
return 1
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
payload = {
|
|
104
|
+
'user' => {
|
|
105
|
+
'password' => new_password
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
@account_users_interface.setopts(options)
|
|
109
|
+
if options[:dry_run]
|
|
110
|
+
print_dry_run @account_users_interface.dry.update(account_id, user['id'], payload)
|
|
111
|
+
return 0
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
unless options[:yes]
|
|
115
|
+
unless ::Morpheus::Cli::OptionTypes::confirm("Are you sure you would like to update the password for user #{user['username']}?", options)
|
|
116
|
+
return 9, "aborted command"
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
json_response = @account_users_interface.update(account_id, user['id'], payload)
|
|
121
|
+
if options[:json]
|
|
122
|
+
puts as_json(json_response)
|
|
123
|
+
elsif !options[:quiet]
|
|
124
|
+
print_green_success "Updated password for user #{user['username']}"
|
|
125
|
+
end
|
|
126
|
+
return 0
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
private
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
end
|
data/lib/morpheus/cli/{cloud_resource_pools_command.rb → commands/cloud_resource_pools_command.rb}
RENAMED
|
@@ -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::CloudResourcePoolsCommand
|
|
8
4
|
include Morpheus::Cli::CliCommand
|
|
@@ -819,7 +815,7 @@ class Morpheus::Cli::CloudResourcePoolsCommand
|
|
|
819
815
|
print_red_alert "Resource Pool not found by name #{name}"
|
|
820
816
|
return nil
|
|
821
817
|
elsif resource_pools.size > 1
|
|
822
|
-
matching_resource_pools =
|
|
818
|
+
matching_resource_pools = resource_pools.select { |it| name && (it['name'] == name || it['externalId'] == name) }
|
|
823
819
|
if matching_resource_pools.size == 1
|
|
824
820
|
return matching_resource_pools[0]
|
|
825
821
|
end
|