morpheus-cli 5.5.3.1 → 5.5.3.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/service_catalog_command.rb +36 -2
- data/lib/morpheus/cli/credentials.rb +2 -1
- data/lib/morpheus/cli/option_types.rb +14 -7
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli.rb +13 -0
- data/test/test_case.rb +3 -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: 4f25e2109b97f86a74285c68d93483095a810007259c98248f3764f047763826
|
4
|
+
data.tar.gz: 703c64d291cebb65e2457c38f43c2fb304881db0cf334c6b86cc3317afd2c543
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e1ca2c4b984cf3b4f27cd3f8348b8ce7155fac65be974962a4a3d543bc6ab35efca1e6e938f6c39617e71dab1d510d87a785a4952eb6c113bbc03a9d6d77173
|
7
|
+
data.tar.gz: 7e00d09edce06f1d099228770835254fde5110f38e4f033529acda0c060f433e55babc72eda319bc79035e5080110ae24b6c4f4eb6600049a99c64aa3699d988
|
data/Dockerfile
CHANGED
@@ -661,7 +661,8 @@ EOT
|
|
661
661
|
it
|
662
662
|
}
|
663
663
|
if catalog_option_types && !catalog_option_types.empty?
|
664
|
-
|
664
|
+
api_params = construct_catalog_api_params(catalog_item_type)
|
665
|
+
config_prompt = Morpheus::Cli::OptionTypes.prompt(catalog_option_types, options[:options], @api_client, api_params, options[:no_prompt], false, false, true)['config']
|
665
666
|
payload[add_item_object_key].deep_merge!({'config' => config_prompt})
|
666
667
|
end
|
667
668
|
if workflow_context
|
@@ -999,11 +1000,13 @@ EOT
|
|
999
1000
|
catalog_option_types = catalog_item_type['optionTypes']
|
1000
1001
|
# instead of config.customOptions just use config...
|
1001
1002
|
catalog_option_types = catalog_option_types.collect {|it|
|
1003
|
+
it['fieldContext'] = nil
|
1002
1004
|
it['fieldContext'] = 'config'
|
1003
1005
|
it
|
1004
1006
|
}
|
1005
1007
|
if catalog_option_types && !catalog_option_types.empty?
|
1006
|
-
|
1008
|
+
api_params = construct_catalog_api_params(catalog_item_type)
|
1009
|
+
config_prompt = Morpheus::Cli::OptionTypes.prompt(catalog_option_types, options[:options], @api_client, api_params, options[:no_prompt], false, false, true)['config']
|
1007
1010
|
item_payload.deep_merge!({'config' => config_prompt})
|
1008
1011
|
end
|
1009
1012
|
|
@@ -1471,4 +1474,35 @@ EOT
|
|
1471
1474
|
out + return_color
|
1472
1475
|
end
|
1473
1476
|
|
1477
|
+
|
1478
|
+
def construct_catalog_api_params(record)
|
1479
|
+
catalog_item_type_id = record['id'].to_i
|
1480
|
+
api_params = {}
|
1481
|
+
api_params['catalogItemType'] ||= {}
|
1482
|
+
api_params['catalogItemType']['id'] = catalog_item_type_id
|
1483
|
+
# Determine instance.type value
|
1484
|
+
# the UI is injecting this parameter into the option source requests
|
1485
|
+
# it is needed to populate api option lists eg. optionTypeClouds
|
1486
|
+
# this should be fixed on the api side, so it automatically extracts this input from the config
|
1487
|
+
begin
|
1488
|
+
instance_type_code = nil
|
1489
|
+
catalog_item_type = find_by_id(:catalog_item_type, catalog_item_type_id.to_i)
|
1490
|
+
if catalog_item_type
|
1491
|
+
if catalog_item_type['type'] == 'instance'
|
1492
|
+
if catalog_item_type['config'] && catalog_item_type['config']['type']
|
1493
|
+
instance_type_code = catalog_item_type['config']['type']
|
1494
|
+
end
|
1495
|
+
end
|
1496
|
+
end
|
1497
|
+
if instance_type_code
|
1498
|
+
api_params['instance'] ||= {}
|
1499
|
+
api_params['instance']['type'] = instance_type_code
|
1500
|
+
end
|
1501
|
+
rescue ::RestClient::Exception => e
|
1502
|
+
# users may not have permission to this endpoint
|
1503
|
+
# puts "Failed to load catalog item type"
|
1504
|
+
end
|
1505
|
+
return api_params
|
1506
|
+
end
|
1507
|
+
|
1474
1508
|
end
|
@@ -123,7 +123,8 @@ module Morpheus
|
|
123
123
|
end
|
124
124
|
if password.empty?
|
125
125
|
# readline is still echoing secret with 'NUL:'' so just use $stdin on windows for now
|
126
|
-
|
126
|
+
# and some other environments? just use noecho unless running unit tests
|
127
|
+
if Morpheus::Cli.windows? || !Morpheus::Cli.testing?
|
127
128
|
print "Password: #{required_blue_prompt} "
|
128
129
|
# this should be my_terminal.stdin instead of STDIN and $stdin
|
129
130
|
password = $stdin.noecho(&:gets).chomp!
|
@@ -55,7 +55,7 @@ module Morpheus
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
def self.prompt(option_types, options={}, api_client=nil, api_params={}, no_prompt=false, paging_enabled=false, ignore_empty=false)
|
58
|
+
def self.prompt(option_types, options={}, api_client=nil, api_params={}, no_prompt=false, paging_enabled=false, ignore_empty=false, skip_sort = false)
|
59
59
|
paging_enabled = false if Morpheus::Cli.windows?
|
60
60
|
no_prompt = no_prompt || options[:no_prompt]
|
61
61
|
results = {}
|
@@ -89,12 +89,18 @@ module Morpheus
|
|
89
89
|
# puts "Options Prompt #{options}"
|
90
90
|
# Sort options by default, group, advanced
|
91
91
|
# add displayOrder if it's missing, so it doesn't end up using a random order
|
92
|
-
if !option_types.find {|it| it['displayOrder'] }
|
93
|
-
|
94
|
-
end
|
92
|
+
# if !option_types.find {|it| it['displayOrder'] && it['displayOrder'] != 0 }
|
93
|
+
# option_types.each_with_index {|it, i| it['displayOrder'] = i+1 }
|
94
|
+
# end
|
95
95
|
cur_field_group = 'default'
|
96
96
|
prompt_local_credentials = true
|
97
|
-
|
97
|
+
# reject help only options..
|
98
|
+
option_types.reject! {|it| it[:for_help_only]}
|
99
|
+
# sort options
|
100
|
+
if !skip_sort
|
101
|
+
option_types = self.sort_option_types(option_types)
|
102
|
+
end
|
103
|
+
option_types.each do |option_type|
|
98
104
|
next if option_type['localCredential'] && !prompt_local_credentials
|
99
105
|
context_map = results
|
100
106
|
value = nil
|
@@ -998,8 +1004,9 @@ module Morpheus
|
|
998
1004
|
def self.password_prompt(option_type)
|
999
1005
|
value_found = false
|
1000
1006
|
while !value_found do
|
1001
|
-
# readline is still echoing secret with 'NUL:'' so just use $stdin on windows
|
1002
|
-
|
1007
|
+
# readline is still echoing secret with 'NUL:'' so just use $stdin on windows
|
1008
|
+
# and some other environments? just use noecho unless running unit tests
|
1009
|
+
if Morpheus::Cli.windows? || !Morpheus::Cli.testing?
|
1003
1010
|
print "#{option_type['fieldLabel']}#{option_type['fieldAddOn'] ? (' (' + option_type['fieldAddOn'] + ') ') : '' }#{optional_label(option_type)}#{option_type['defaultValue'] ? ' ['+'************'+']' : ''}: "
|
1004
1011
|
input = $stdin.noecho(&:gets).chomp!
|
1005
1012
|
else
|
data/lib/morpheus/cli/version.rb
CHANGED
data/lib/morpheus/cli.rb
CHANGED
@@ -77,6 +77,19 @@ module Morpheus
|
|
77
77
|
Dir[File.dirname(__FILE__) + "/cli/commands/**/*.rb"].each {|file| load file }
|
78
78
|
end
|
79
79
|
|
80
|
+
# hack needed for unit tests right now
|
81
|
+
@@testing = false unless defined?(@@testing)
|
82
|
+
|
83
|
+
# hack needed for unit tests right now
|
84
|
+
def self.enable_test_mode
|
85
|
+
@@testing = true
|
86
|
+
end
|
87
|
+
|
88
|
+
# hack needed for unit tests right now
|
89
|
+
def self.testing?
|
90
|
+
defined?(@@testing) && @@testing == true
|
91
|
+
end
|
92
|
+
|
80
93
|
# require all CLI modules now (on require)
|
81
94
|
load!
|
82
95
|
|
data/test/test_case.rb
CHANGED
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: 5.5.3.
|
4
|
+
version: 5.5.3.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: 2023-
|
14
|
+
date: 2023-02-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|