morpheus-cli 2.10.0 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/morpheus +27 -32
- data/lib/morpheus/api/accounts_interface.rb +36 -47
- data/lib/morpheus/api/api_client.rb +141 -110
- data/lib/morpheus/api/app_templates_interface.rb +56 -72
- data/lib/morpheus/api/apps_interface.rb +111 -132
- data/lib/morpheus/api/auth_interface.rb +30 -0
- data/lib/morpheus/api/clouds_interface.rb +71 -76
- data/lib/morpheus/api/custom_instance_types_interface.rb +21 -46
- data/lib/morpheus/api/dashboard_interface.rb +10 -17
- data/lib/morpheus/api/deploy_interface.rb +60 -72
- data/lib/morpheus/api/deployments_interface.rb +53 -71
- data/lib/morpheus/api/groups_interface.rb +55 -45
- data/lib/morpheus/api/instance_types_interface.rb +19 -23
- data/lib/morpheus/api/instances_interface.rb +179 -177
- data/lib/morpheus/api/key_pairs_interface.rb +11 -17
- data/lib/morpheus/api/license_interface.rb +18 -23
- data/lib/morpheus/api/load_balancers_interface.rb +54 -69
- data/lib/morpheus/api/logs_interface.rb +25 -29
- data/lib/morpheus/api/options_interface.rb +13 -17
- data/lib/morpheus/api/provision_types_interface.rb +19 -22
- data/lib/morpheus/api/roles_interface.rb +75 -94
- data/lib/morpheus/api/security_group_rules_interface.rb +28 -37
- data/lib/morpheus/api/security_groups_interface.rb +39 -51
- data/lib/morpheus/api/servers_interface.rb +113 -115
- data/lib/morpheus/api/setup_interface.rb +31 -0
- data/lib/morpheus/api/task_sets_interface.rb +36 -38
- data/lib/morpheus/api/tasks_interface.rb +56 -69
- data/lib/morpheus/api/users_interface.rb +67 -76
- data/lib/morpheus/api/virtual_images_interface.rb +61 -61
- data/lib/morpheus/api/whoami_interface.rb +12 -15
- data/lib/morpheus/cli.rb +71 -60
- data/lib/morpheus/cli/accounts.rb +254 -315
- data/lib/morpheus/cli/alias_command.rb +219 -0
- data/lib/morpheus/cli/app_templates.rb +264 -272
- data/lib/morpheus/cli/apps.rb +608 -671
- data/lib/morpheus/cli/cli_command.rb +259 -21
- data/lib/morpheus/cli/cli_registry.rb +99 -14
- data/lib/morpheus/cli/clouds.rb +599 -372
- data/lib/morpheus/cli/config_file.rb +126 -0
- data/lib/morpheus/cli/credentials.rb +141 -117
- data/lib/morpheus/cli/dashboard_command.rb +48 -56
- data/lib/morpheus/cli/deployments.rb +254 -268
- data/lib/morpheus/cli/deploys.rb +150 -142
- data/lib/morpheus/cli/error_handler.rb +38 -0
- data/lib/morpheus/cli/groups.rb +551 -179
- data/lib/morpheus/cli/hosts.rb +862 -617
- data/lib/morpheus/cli/instance_types.rb +103 -95
- data/lib/morpheus/cli/instances.rb +1335 -1009
- data/lib/morpheus/cli/key_pairs.rb +82 -90
- data/lib/morpheus/cli/library.rb +498 -499
- data/lib/morpheus/cli/license.rb +83 -101
- data/lib/morpheus/cli/load_balancers.rb +314 -300
- data/lib/morpheus/cli/login.rb +66 -44
- data/lib/morpheus/cli/logout.rb +47 -46
- data/lib/morpheus/cli/mixins/accounts_helper.rb +69 -31
- data/lib/morpheus/cli/mixins/infrastructure_helper.rb +106 -0
- data/lib/morpheus/cli/mixins/print_helper.rb +181 -17
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +535 -458
- data/lib/morpheus/cli/mixins/whoami_helper.rb +2 -2
- data/lib/morpheus/cli/option_parser.rb +35 -0
- data/lib/morpheus/cli/option_types.rb +232 -192
- data/lib/morpheus/cli/recent_activity_command.rb +61 -65
- data/lib/morpheus/cli/remote.rb +446 -199
- data/lib/morpheus/cli/roles.rb +884 -906
- data/lib/morpheus/cli/security_group_rules.rb +213 -203
- data/lib/morpheus/cli/security_groups.rb +237 -192
- data/lib/morpheus/cli/shell.rb +338 -231
- data/lib/morpheus/cli/tasks.rb +326 -308
- data/lib/morpheus/cli/users.rb +457 -462
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/version_command.rb +16 -18
- data/lib/morpheus/cli/virtual_images.rb +526 -345
- data/lib/morpheus/cli/whoami.rb +125 -111
- data/lib/morpheus/cli/workflows.rb +338 -185
- data/lib/morpheus/formatters.rb +8 -1
- data/lib/morpheus/logging.rb +1 -1
- data/lib/morpheus/rest_client.rb +17 -8
- metadata +9 -3
- data/lib/morpheus/api/custom_instance_types.rb +0 -55
@@ -5,291 +5,277 @@ require 'table_print'
|
|
5
5
|
require 'morpheus/cli/cli_command'
|
6
6
|
|
7
7
|
class Morpheus::Cli::Deployments
|
8
|
-
|
8
|
+
include Morpheus::Cli::CliCommand
|
9
9
|
|
10
|
-
|
11
|
-
@appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
|
12
|
-
end
|
10
|
+
register_subcommands :list, :add, :update, :remove, {:versions => 'list_versions'}
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
@appliance_name = opts[:remote]
|
18
|
-
@access_token = Morpheus::Cli::Credentials.new(@appliance_name,@appliance_url).request_credentials(opts)
|
19
|
-
else
|
20
|
-
@access_token = Morpheus::Cli::Credentials.new(@appliance_name,@appliance_url).request_credentials(opts)
|
21
|
-
end
|
22
|
-
@api_client = Morpheus::APIClient.new(@access_token,nil,nil, @appliance_url)
|
23
|
-
@deployments_interface = Morpheus::APIClient.new(@access_token,nil,nil, @appliance_url).deployments
|
24
|
-
if @access_token.empty?
|
25
|
-
print_red_alert "Invalid Credentials. Unable to acquire access token. Please verify your credentials and try again."
|
26
|
-
exit 1
|
27
|
-
end
|
28
|
-
end
|
12
|
+
def initialize()
|
13
|
+
# @appliance_name, @appliance_url = Morpheus::Cli::Remote.active_appliance
|
14
|
+
end
|
29
15
|
|
16
|
+
def connect(opts)
|
17
|
+
@api_client = establish_remote_appliance_connection(opts)
|
18
|
+
@deployments_interface = Morpheus::APIClient.new(@access_token,nil,nil, @appliance_url).deployments
|
19
|
+
end
|
30
20
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
return
|
35
|
-
end
|
21
|
+
def handle(args)
|
22
|
+
handle_subcommand(args)
|
23
|
+
end
|
36
24
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
25
|
+
def list(args)
|
26
|
+
options = {}
|
27
|
+
optparse = OptionParser.new do|opts|
|
28
|
+
opts.banner = subcommand_usage()
|
29
|
+
build_common_options(opts, options, [:list, :json, :dry_run, :remote])
|
30
|
+
end
|
31
|
+
optparse.parse!(args)
|
32
|
+
connect(options)
|
33
|
+
begin
|
34
|
+
params = {}
|
35
|
+
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
36
|
+
params[k] = options[k] unless options[k].nil?
|
37
|
+
end
|
38
|
+
if options[:dry_run]
|
39
|
+
print_dry_run @deployments_interface.dry.get(params)
|
40
|
+
return
|
41
|
+
end
|
42
|
+
json_response = @deployments_interface.get(params)
|
43
|
+
if options[:json]
|
44
|
+
puts JSON.pretty_generate(json_response)
|
45
|
+
else
|
46
|
+
deployments = json_response['deployments']
|
47
|
+
print "\n" ,cyan, bold, "Morpheus Deployments\n","====================", reset, "\n\n"
|
48
|
+
if deployments.empty?
|
49
|
+
puts yellow,"No deployments currently configured.",reset
|
50
|
+
else
|
51
|
+
print cyan
|
52
|
+
deployments_table_data = deployments.collect do |deployment|
|
53
|
+
{name: deployment['name'], id: deployment['id'], description: deployment['description'], updated: format_local_dt(deployment['lastUpdated'])}
|
54
|
+
end
|
55
|
+
tp deployments_table_data, :id, :name, :description, :updated
|
56
|
+
end
|
57
|
+
print reset,"\n"
|
58
|
+
end
|
59
|
+
rescue RestClient::Exception => e
|
60
|
+
print_rest_exception(e, options)
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
end
|
53
64
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
puts yellow,"No deployments currently configured.",reset
|
75
|
-
else
|
76
|
-
print cyan
|
77
|
-
deployments_table_data = deployments.collect do |deployment|
|
78
|
-
{name: deployment['name'], id: deployment['id'], description: deployment['description'], updated: format_local_dt(deployment['lastUpdated'])}
|
79
|
-
end
|
80
|
-
tp deployments_table_data, :id, :name, :description, :updated
|
81
|
-
end
|
82
|
-
print reset,"\n\n"
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
rescue RestClient::Exception => e
|
87
|
-
print_rest_exception(e, options)
|
88
|
-
exit 1
|
89
|
-
end
|
90
|
-
end
|
65
|
+
def list_versions(args)
|
66
|
+
options = {}
|
67
|
+
optparse = OptionParser.new do|opts|
|
68
|
+
opts.banner = subcommand_usage("[name] versions")
|
69
|
+
build_common_options(opts, options, [:list, :json, :dry_run, :remote])
|
70
|
+
end
|
71
|
+
optparse.parse!(args)
|
72
|
+
if args.count < 1
|
73
|
+
puts optparse
|
74
|
+
exit 1
|
75
|
+
end
|
76
|
+
deployment_name = args[0]
|
77
|
+
connect(options)
|
78
|
+
begin
|
79
|
+
params = {}
|
80
|
+
[:phrase, :offset, :max, :sort, :direction].each do |k|
|
81
|
+
params[k] = options[k] unless options[k].nil?
|
82
|
+
end
|
83
|
+
deployment = find_deployment_by_name_or_id(deployment_name)
|
84
|
+
exit 1 if deployment.nil?
|
91
85
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
86
|
+
if options[:dry_run]
|
87
|
+
print_dry_run @deployments_interface.dry.list_versions(deployment['id'],params)
|
88
|
+
return
|
89
|
+
end
|
90
|
+
json_response = @deployments_interface.list_versions(deployment['id'],params)
|
91
|
+
if options[:json]
|
92
|
+
puts JSON.pretty_generate(json_response)
|
93
|
+
else
|
94
|
+
versions = json_response['versions']
|
95
|
+
print "\n" ,cyan, bold, "Morpheus Deployment Versions\n","=============================", reset, "\n\n"
|
96
|
+
if versions.empty?
|
97
|
+
puts yellow,"No deployment versions currently exist.",reset
|
98
|
+
else
|
99
|
+
print cyan
|
100
|
+
versions_table_data = versions.collect do |version|
|
101
|
+
{version: version['userVersion'], type: version['deployType'], updated: format_local_dt(version['lastUpdated'])}
|
102
|
+
end
|
103
|
+
tp versions_table_data, :version, :type, :updated
|
104
|
+
end
|
105
|
+
print reset,"\n"
|
106
|
+
end
|
107
|
+
rescue RestClient::Exception => e
|
108
|
+
print_rest_exception(e, options)
|
109
|
+
exit 1
|
110
|
+
end
|
111
|
+
end
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
rescue RestClient::Exception => e
|
131
|
-
print_rest_exception(e, options)
|
132
|
-
exit 1
|
133
|
-
end
|
134
|
-
end
|
113
|
+
def update(args)
|
114
|
+
deployment_name = args[0]
|
115
|
+
options = {}
|
116
|
+
account_name = nil
|
117
|
+
optparse = OptionParser.new do|opts|
|
118
|
+
opts.banner = subcommand_usage("[name] [options]")
|
119
|
+
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
120
|
+
end
|
121
|
+
optparse.parse!(args)
|
122
|
+
if args.count < 1
|
123
|
+
puts optparse
|
124
|
+
exit 1
|
125
|
+
end
|
126
|
+
connect(options)
|
127
|
+
begin
|
128
|
+
deployment = find_deployment_by_name_or_id(deployment_name)
|
129
|
+
exit 1 if deployment.nil?
|
135
130
|
|
136
|
-
|
137
|
-
|
138
|
-
options = {}
|
139
|
-
account_name = nil
|
140
|
-
optparse = OptionParser.new do|opts|
|
141
|
-
opts.banner = "Usage: morpheus deployments update [deployment] [options]"
|
142
|
-
build_common_options(opts, options, [:options, :json, :remote])
|
143
|
-
end
|
144
|
-
if args.count < 1
|
145
|
-
puts "\n#{optparse.banner}\n\n"
|
146
|
-
exit 1
|
147
|
-
end
|
148
|
-
optparse.parse(args)
|
131
|
+
#params = Morpheus::Cli::OptionTypes.prompt(add_user_option_types, options[:options], @api_client, options[:params]) # options[:params] is mysterious
|
132
|
+
params = options[:options] || {}
|
149
133
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
134
|
+
if params.empty?
|
135
|
+
puts optparse
|
136
|
+
option_lines = update_deployment_option_types().collect {|it| "\t-O #{it['fieldContext'] ? (it['fieldContext'] + '.') : ''}#{it['fieldName']}=\"value\"" }.join("\n")
|
137
|
+
puts "\nAvailable Options:\n#{option_lines}\n\n"
|
138
|
+
exit 1
|
139
|
+
end
|
155
140
|
|
156
|
-
|
157
|
-
|
141
|
+
#puts "parsed params is : #{params.inspect}"
|
142
|
+
deployment_keys = ['name','description']
|
143
|
+
changes_payload = (params.select {|k,v| deployment_keys.include?(k) })
|
144
|
+
deployment_payload = deployment
|
145
|
+
if changes_payload
|
146
|
+
deployment_payload.merge!(changes_payload)
|
147
|
+
end
|
158
148
|
|
159
|
-
if params.empty?
|
160
|
-
puts "\n#{optparse.banner}\n\n"
|
161
|
-
option_lines = update_deployment_option_types().collect {|it| "\t-O #{it['fieldContext'] ? (it['fieldContext'] + '.') : ''}#{it['fieldName']}=\"value\"" }.join("\n")
|
162
|
-
puts "\nAvailable Options:\n#{option_lines}\n\n"
|
163
|
-
exit 1
|
164
|
-
end
|
165
149
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
150
|
+
payload = {deployment: deployment_payload}
|
151
|
+
if options[:dry_run]
|
152
|
+
print_dry_run @deployments_interface.dry.update(deployment['id'], payload)
|
153
|
+
return
|
154
|
+
end
|
155
|
+
response = @deployments_interface.update(deployment['id'], payload)
|
156
|
+
if options[:json]
|
157
|
+
print JSON.pretty_generate(json_response)
|
158
|
+
if !response['success']
|
159
|
+
exit 1
|
160
|
+
end
|
161
|
+
else
|
162
|
+
print "\n", cyan, "Deployment #{response['deployment']['name']} updated", reset, "\n\n"
|
163
|
+
end
|
164
|
+
rescue RestClient::Exception => e
|
165
|
+
print_rest_exception(e, options)
|
166
|
+
exit 1
|
167
|
+
end
|
168
|
+
end
|
173
169
|
|
170
|
+
def add(args)
|
171
|
+
options = {}
|
172
|
+
optparse = OptionParser.new do|opts|
|
173
|
+
opts.banner = subcommand_usage("[name]")
|
174
|
+
opts.on( '-d', '--description DESCRIPTION', "Description" ) do |val|
|
175
|
+
options[:description] = val
|
176
|
+
end
|
177
|
+
build_common_options(opts, options, [:options, :json, :dry_run, :remote])
|
178
|
+
end
|
179
|
+
optparse.parse!(args)
|
180
|
+
if args.count < 1
|
181
|
+
puts optparse
|
182
|
+
exit 1
|
183
|
+
end
|
184
|
+
deployment_name = args[0]
|
185
|
+
connect(options)
|
186
|
+
begin
|
187
|
+
payload = {deployment: {name: deployment_name, description: options[:description]}}
|
188
|
+
if options[:dry_run]
|
189
|
+
print_dry_run @deployments_interface.dry.create(payload)
|
190
|
+
return
|
191
|
+
end
|
192
|
+
json_response = @deployments_interface.create(payload)
|
193
|
+
if options[:json]
|
194
|
+
print JSON.pretty_generate(json_response)
|
195
|
+
else
|
196
|
+
print "\n", cyan, "Deployment #{json_response['deployment']['name']} created successfully", reset, "\n\n"
|
197
|
+
end
|
198
|
+
rescue RestClient::Exception => e
|
199
|
+
print_rest_exception(e, options)
|
200
|
+
exit 1
|
201
|
+
end
|
202
|
+
end
|
174
203
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
204
|
+
def remove(args)
|
205
|
+
options = {}
|
206
|
+
optparse = OptionParser.new do|opts|
|
207
|
+
opts.banner = subcommand_usage("[name]")
|
208
|
+
build_common_options(opts, options, [:auto_confirm, :json, :dry_run, :remote])
|
209
|
+
end
|
210
|
+
optparse.parse!(args)
|
211
|
+
if args.count < 1
|
212
|
+
puts optparse
|
213
|
+
exit 1
|
214
|
+
end
|
215
|
+
deployment_name = args[0]
|
216
|
+
connect(options)
|
217
|
+
begin
|
218
|
+
deployment = find_deployment_by_name_or_id(deployment_name)
|
219
|
+
exit 1 if deployment.nil?
|
220
|
+
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the deployment #{deployment['name']}?")
|
221
|
+
exit
|
222
|
+
end
|
223
|
+
if options[:dry_run]
|
224
|
+
print_dry_run @deployments_interface.dry.destroy(deployment['id'])
|
225
|
+
return
|
226
|
+
end
|
227
|
+
json_response = @deployments_interface.destroy(deployment['id'])
|
228
|
+
if options[:json]
|
229
|
+
print JSON.pretty_generate(json_response)
|
230
|
+
else
|
231
|
+
print "\n", cyan, "Deployment #{deployment['name']} removed", reset, "\n\n"
|
232
|
+
end
|
233
|
+
rescue RestClient::Exception => e
|
234
|
+
print_rest_exception(e, options)
|
235
|
+
exit 1
|
236
|
+
end
|
237
|
+
end
|
190
238
|
|
191
|
-
def add(args)
|
192
|
-
deployment_name = args[0]
|
193
|
-
options = {}
|
194
|
-
optparse = OptionParser.new do|opts|
|
195
|
-
opts.banner = "Usage: morpheus deployments add [name]"
|
196
|
-
opts.on( '-d', '--description DESCRIPTION', "Description" ) do |val|
|
197
|
-
options[:description] = val
|
198
|
-
end
|
199
|
-
build_common_options(opts, options, [:options, :json, :remote])
|
200
|
-
end
|
201
|
-
if args.count < 1
|
202
|
-
puts "\n#{optparse.banner}\n\n"
|
203
|
-
exit 1
|
204
|
-
end
|
205
|
-
optparse.parse(args)
|
206
|
-
connect(options)
|
207
239
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
240
|
+
private
|
241
|
+
def find_deployment_by_name_or_id(val)
|
242
|
+
raise "find_deployment_by_name_or_id passed a bad name: #{val.inspect}" if val.to_s == ''
|
243
|
+
results = @deployments_interface.get(val)
|
244
|
+
result = nil
|
245
|
+
if !results['deployments'].nil? && !results['deployments'].empty?
|
246
|
+
result = results['deployments'][0]
|
247
|
+
elsif val.to_i.to_s == val
|
248
|
+
results = @deployments_interface.get(val.to_i)
|
249
|
+
result = results['deployment']
|
250
|
+
end
|
251
|
+
if result.nil?
|
252
|
+
print_red_alert "Deployment not found by '#{val}'"
|
253
|
+
return nil
|
254
|
+
end
|
255
|
+
return result
|
256
|
+
end
|
221
257
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
unless options[:yes] || Morpheus::Cli::OptionTypes.confirm("Are you sure you want to delete the deployment #{deployment['name']}?")
|
239
|
-
exit
|
240
|
-
end
|
241
|
-
json_response = @deployments_interface.destroy(deployment['id'])
|
242
|
-
if options[:json]
|
243
|
-
print JSON.pretty_generate(json_response)
|
244
|
-
else
|
245
|
-
print "\n", cyan, "Deployment #{deployment['name']} removed", reset, "\n\n"
|
246
|
-
end
|
247
|
-
rescue RestClient::Exception => e
|
248
|
-
print_rest_exception(e, options)
|
249
|
-
exit 1
|
250
|
-
end
|
251
|
-
end
|
258
|
+
def find_deployment_type_by_name(val)
|
259
|
+
raise "find_deployment_type_by_name passed a bad name: #{val.inspect}" if val.to_s == ''
|
260
|
+
results = @deployments_interface.deployment_types(val)
|
261
|
+
result = nil
|
262
|
+
if !results['deploymentTypes'].nil? && !results['deploymentTypes'].empty?
|
263
|
+
result = results['deploymentTypes'][0]
|
264
|
+
elsif val.to_i.to_s == val
|
265
|
+
results = @deployments_interface.deployment_types(val.to_i)
|
266
|
+
result = results['deploymentType']
|
267
|
+
end
|
268
|
+
if result.nil?
|
269
|
+
print_red_alert "Deployment Type not found by '#{val}'"
|
270
|
+
return nil
|
271
|
+
end
|
272
|
+
return result
|
273
|
+
end
|
252
274
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
if !results['deployments'].nil? && !results['deployments'].empty?
|
260
|
-
result = results['deployments'][0]
|
261
|
-
elsif val.to_i.to_s == val
|
262
|
-
results = @deployments_interface.get(val.to_i)
|
263
|
-
result = results['deployment']
|
264
|
-
end
|
265
|
-
if result.nil?
|
266
|
-
print_red_alert "Deployment not found by '#{val}'"
|
267
|
-
return nil
|
268
|
-
end
|
269
|
-
return result
|
270
|
-
end
|
271
|
-
|
272
|
-
def find_deployment_type_by_name(val)
|
273
|
-
raise "find_deployment_type_by_name passed a bad name: #{val.inspect}" if val.to_s == ''
|
274
|
-
results = @deployments_interface.deployment_types(val)
|
275
|
-
result = nil
|
276
|
-
if !results['deploymentTypes'].nil? && !results['deploymentTypes'].empty?
|
277
|
-
result = results['deploymentTypes'][0]
|
278
|
-
elsif val.to_i.to_s == val
|
279
|
-
results = @deployments_interface.deployment_types(val.to_i)
|
280
|
-
result = results['deploymentType']
|
281
|
-
end
|
282
|
-
if result.nil?
|
283
|
-
print_red_alert "Deployment Type not found by '#{val}'"
|
284
|
-
return nil
|
285
|
-
end
|
286
|
-
return result
|
287
|
-
end
|
288
|
-
|
289
|
-
def update_deployment_option_types()
|
290
|
-
[
|
291
|
-
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'displayOrder' => 0},
|
292
|
-
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'required' => false, 'displayOrder' => 1}
|
293
|
-
]
|
294
|
-
end
|
275
|
+
def update_deployment_option_types()
|
276
|
+
[
|
277
|
+
{'fieldName' => 'name', 'fieldLabel' => 'Name', 'type' => 'text', 'required' => true, 'displayOrder' => 0},
|
278
|
+
{'fieldName' => 'description', 'fieldLabel' => 'Description', 'type' => 'text', 'required' => false, 'displayOrder' => 1}
|
279
|
+
]
|
280
|
+
end
|
295
281
|
end
|