morpheus-cli 9.1.0 → 9.1.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/cli/commands/clusters.rb +3 -2
- data/lib/morpheus/cli/commands/virtual_images.rb +1 -17
- data/lib/morpheus/cli/option_types.rb +35 -17
- data/lib/morpheus/cli/version.rb +1 -1
- data/test/cli/clusters_uuid_test.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cfcf9aafbbcc8d9426f1c6afdd99ee2255f4afaaaf62365610bff439a9e5eb9
|
|
4
|
+
data.tar.gz: 148d517d2e3d13ca1ca8f999c41fcf35ebe736b915670eb9ec63d68fcbc20188
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af9935ac240af7be0b214226182b1e7f545cb5026cf43f1a1f0d9f299f7174b2d264def240be477d421e2a07ee178a8c7158848cb6092a24ebc8cf804464005e
|
|
7
|
+
data.tar.gz: d3d801763aa834e776df6fe0a5de971f163b4fc886e65b9fedabbea94412185fd4438cea1702c0ffb30461f1dc286d60d699d7f88057755d9805e15dcbbbb2d5
|
data/Dockerfile
CHANGED
|
@@ -152,7 +152,7 @@ class Morpheus::Cli::Clusters
|
|
|
152
152
|
def get(args)
|
|
153
153
|
options = {}
|
|
154
154
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
|
155
|
-
opts.banner = subcommand_usage("[cluster]")
|
|
155
|
+
opts.banner = subcommand_usage("[cluster...]")
|
|
156
156
|
opts.on( nil, '--hosts', "Display masters and workers" ) do
|
|
157
157
|
options[:show_masters] = true
|
|
158
158
|
options[:show_workers] = true
|
|
@@ -176,7 +176,8 @@ class Morpheus::Cli::Clusters
|
|
|
176
176
|
options[:refresh_until_status] = val.to_s.downcase
|
|
177
177
|
end
|
|
178
178
|
build_common_options(opts, options, [:json, :dry_run, :remote])
|
|
179
|
-
opts.footer = "Get details about
|
|
179
|
+
opts.footer = "Get details about one or more clusters.\n" +
|
|
180
|
+
"At least one [cluster] is required. Each identifier can be an id, name, or uuid. Supports 1-N [cluster] arguments."
|
|
180
181
|
end
|
|
181
182
|
optparse.parse!(args)
|
|
182
183
|
if args.count < 1
|
|
@@ -1249,24 +1249,8 @@ EOT
|
|
|
1249
1249
|
publisher_value = marketplace_option['publisher']
|
|
1250
1250
|
|
|
1251
1251
|
# SKU & VERSION
|
|
1252
|
-
if options[:options] && options[:options]['sku'] && options[:options]['version']
|
|
1253
|
-
# the value to match on is actually sku|version
|
|
1254
|
-
options[:options]['sku'] = options[:options]['sku'] + '|' + options[:options]['version']
|
|
1255
|
-
end
|
|
1256
1252
|
sku_api_params = {'zoneId' => cloud_id, publisher: publisher_value, offer: offer_value}
|
|
1257
|
-
|
|
1258
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'sku', 'fieldLabel' => 'Azure Marketplace SKU', 'type' => 'select', 'optionSourceType' => 'azure', 'optionSource' => 'searchAzureMarketplaceSkus', 'required' => true, 'description' => "Select Azure Marketplace SKU and Version, the format is SKU|Version"}], options[:options],@api_client, sku_api_params)
|
|
1259
|
-
rescue => ex
|
|
1260
|
-
Morpheus::Logging::DarkPrinter.puts "Failed to load azure marketplace offers, trying older endpoint" if Morpheus::Logging.debug?
|
|
1261
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'sku', 'fieldLabel' => 'Azure Marketplace SKU', 'type' => 'select', 'optionSource' => 'searchAzureMarketplaceSkus', 'required' => true, 'description' => "Select Azure Marketplace SKU and Version, the format is SKU|Version"}], options[:options],@api_client, sku_api_params)
|
|
1262
|
-
end
|
|
1263
|
-
# marketplace_option = Morpheus::Cli::OptionTypes.get_last_select()
|
|
1264
|
-
# sku_value = marketplace_option['sku']
|
|
1265
|
-
# version_value = marketplace_option['version']
|
|
1266
|
-
sku_value = v_prompt['sku']
|
|
1267
|
-
if sku_value && sku_value.include?("|")
|
|
1268
|
-
sku_value, version_value = sku_value.split("|")
|
|
1269
|
-
end
|
|
1253
|
+
sku_value, version_value = Morpheus::Cli::OptionTypes.prompt_azure_marketplace_sku_and_version('sku', 'version', options[:options], @api_client, sku_api_params)
|
|
1270
1254
|
|
|
1271
1255
|
rtn['publisher'] = publisher_value
|
|
1272
1256
|
rtn['offer'] = offer_value
|
|
@@ -1392,24 +1392,10 @@ module Morpheus
|
|
|
1392
1392
|
publisher_value = marketplace_option['publisher']
|
|
1393
1393
|
|
|
1394
1394
|
# SKU & VERSION
|
|
1395
|
-
if options && options['marketplaceSku'] && options['marketplaceVersion']
|
|
1396
|
-
# the value to match on is actually sku|version
|
|
1397
|
-
options['marketplaceSku'] = options['marketplaceSku'] + '|' + options['marketplaceVersion']
|
|
1398
|
-
end
|
|
1399
1395
|
sku_api_params = {'zoneId' => cloud_id, publisher: publisher_value, offer: offer_value}
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
Morpheus::Logging::DarkPrinter.puts "Failed to load azure marketplace offers, trying older endpoint" if Morpheus::Logging.debug?
|
|
1404
|
-
v_prompt = prompt([{'fieldName' => 'marketplaceSku', 'fieldLabel' => 'Azure Marketplace SKU', 'type' => 'select', 'optionSource' => 'searchAzureMarketplaceSkus', 'required' => true, 'description' => "Select Azure Marketplace SKU and Version, the format is SKU|Version"}], options,api_client, sku_api_params)
|
|
1405
|
-
end
|
|
1406
|
-
# marketplace_option = Morpheus::Cli::OptionTypes.get_last_select()
|
|
1407
|
-
# sku_value = marketplace_option['sku']
|
|
1408
|
-
# version_value = marketplace_option['version']
|
|
1409
|
-
sku_value = v_prompt['marketplaceSku']
|
|
1410
|
-
if sku_value && sku_value.include?("|")
|
|
1411
|
-
sku_value, version_value = sku_value.split("|")
|
|
1412
|
-
end
|
|
1396
|
+
resource_pool_id = api_params['resourcePoolId'] || api_params[:resourcePoolId]
|
|
1397
|
+
sku_api_params['resourcePoolId'] = resource_pool_id if resource_pool_id
|
|
1398
|
+
sku_value, version_value = prompt_azure_marketplace_sku_and_version('marketplaceSku', 'marketplaceVersion', options, api_client, sku_api_params)
|
|
1413
1399
|
# rtn['publisher'] = publisher_value
|
|
1414
1400
|
# rtn['offer'] = offer_value
|
|
1415
1401
|
# rtn['sku'] = sku_value
|
|
@@ -1419,6 +1405,38 @@ module Morpheus
|
|
|
1419
1405
|
return {'marketplacePublisher' => publisher_value, 'marketplaceOffer' => offer_value, 'marketplaceSku' => sku_value, 'marketplaceVersion' => version_value}
|
|
1420
1406
|
end
|
|
1421
1407
|
|
|
1408
|
+
# Prompts for an Azure Marketplace SKU and then its version.
|
|
1409
|
+
# A combined SKU|Version value is still accepted and split into the two fields.
|
|
1410
|
+
# Older appliances list each SKU and version together as a single SKU|Version option.
|
|
1411
|
+
def self.prompt_azure_marketplace_sku_and_version(sku_field, version_field, options, api_client, api_params)
|
|
1412
|
+
options ||= {}
|
|
1413
|
+
sku_value, version_value = options[sku_field], options[version_field]
|
|
1414
|
+
if sku_value.to_s.include?('|')
|
|
1415
|
+
sku_value, version_value = sku_value.to_s.split('|', 2)
|
|
1416
|
+
end
|
|
1417
|
+
source_type = 'azure'
|
|
1418
|
+
begin
|
|
1419
|
+
sku_options = load_source_options('searchAzureMarketplaceSkus', source_type, api_client, api_params)
|
|
1420
|
+
rescue => ex
|
|
1421
|
+
Morpheus::Logging::DarkPrinter.puts "Failed to load azure marketplace skus, trying older endpoint" if Morpheus::Logging.debug?
|
|
1422
|
+
source_type = nil
|
|
1423
|
+
sku_options = load_source_options('searchAzureMarketplaceSkus', source_type, api_client, api_params)
|
|
1424
|
+
end
|
|
1425
|
+
sku_option_type = {'fieldName' => sku_field, 'fieldLabel' => 'Azure Marketplace SKU', 'type' => 'select', 'selectOptions' => sku_options || [], 'required' => true}
|
|
1426
|
+
if (sku_options || []).any? {|it| it['value'].to_s.include?('|') }
|
|
1427
|
+
options[sku_field] = "#{sku_value}|#{version_value}" if sku_value && version_value
|
|
1428
|
+
sku_option_type['description'] = "Select Azure Marketplace SKU and Version, the format is SKU|Version"
|
|
1429
|
+
return prompt([sku_option_type], options, api_client, api_params)[sku_field].to_s.split('|', 2)
|
|
1430
|
+
end
|
|
1431
|
+
options[sku_field] = sku_value if sku_value
|
|
1432
|
+
sku_option_type['description'] = "Select Azure Marketplace SKU."
|
|
1433
|
+
sku_value = prompt([sku_option_type], options, api_client, api_params)[sku_field]
|
|
1434
|
+
options[version_field] = version_value if version_value
|
|
1435
|
+
version_option_type = {'fieldName' => version_field, 'fieldLabel' => 'Azure Marketplace Version', 'type' => 'select', 'optionSourceType' => 'azure', 'optionSource' => 'searchAzureMarketplaceVersions', 'required' => true, 'defaultFirstOption' => true, 'description' => "Select Azure Marketplace Version. The newest version is listed first."}
|
|
1436
|
+
version_value = prompt([version_option_type], options, api_client, api_params.merge(sku: sku_value))[version_field]
|
|
1437
|
+
return sku_value, version_value
|
|
1438
|
+
end
|
|
1439
|
+
|
|
1422
1440
|
def self.load_options(option_type, api_client, api_params, query_value=nil)
|
|
1423
1441
|
field_key = [option_type['fieldContext'], option_type['fieldName']].select {|it| it && it != '' }.join('.')
|
|
1424
1442
|
help_field_key = option_type[:help_field_prefix] ? "#{option_type[:help_field_prefix]}.#{field_key}" : field_key
|
data/lib/morpheus/cli/version.rb
CHANGED
|
@@ -48,6 +48,21 @@ class ClustersUuidTest < Test::Unit::TestCase
|
|
|
48
48
|
@uuid = 'a1b2c3d4-e5f6-4711-8899-0011223344ff'
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
def test_get_help_documents_multiple_cluster_identifiers
|
|
52
|
+
command, clusters = build_command
|
|
53
|
+
output = capture_stdout do
|
|
54
|
+
error = assert_raise(SystemExit) { command.get(['--help']) }
|
|
55
|
+
assert_equal 0, error.status
|
|
56
|
+
end
|
|
57
|
+
assert_match(/Usage: morpheus clusters get \[cluster\.\.\.\]/, output)
|
|
58
|
+
assert_include output, 'Get details about one or more clusters.'
|
|
59
|
+
assert_include output, 'At least one [cluster] is required.'
|
|
60
|
+
assert_include output, 'Each identifier can be an id, name, or uuid.'
|
|
61
|
+
assert_include output, 'Supports 1-N [cluster] arguments.'
|
|
62
|
+
assert_empty clusters.get_calls
|
|
63
|
+
assert_empty clusters.list_calls
|
|
64
|
+
end
|
|
65
|
+
|
|
51
66
|
## find_cluster_by_name_or_id dispatch
|
|
52
67
|
|
|
53
68
|
def test_uuid_resolves_via_path_get_not_name_list
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: morpheus-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 9.1.
|
|
4
|
+
version: 9.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Estes
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2026-
|
|
14
|
+
date: 2026-12-04 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: tins
|