morpheus-cli 3.6.37 → 3.6.38
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6d83bc4ead195eec6c07b13e808adadbb2252faecb60ea09ef380c351a29439
|
4
|
+
data.tar.gz: ac48e6230def4ee50088e8b5a9872619d806aff93efde92a0834a6613461d8b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdc430523df174d81db58e7cadffa72fda83dfe97dd941b637b20469663c1e85608d4f973bf5abedc079ce1a402593c2d730b33e49e31741a074ec5e485b438a
|
7
|
+
data.tar.gz: 2c623442ca4e4bfca590acec732930d9698127172c7a9d4507ae7dcf007381b0385d28588dc5f486acb530896fc324c6a2f0a5e9a9dd375890e5c279ad2810a2
|
@@ -158,10 +158,8 @@ class Morpheus::Cli::MonitoringAppsCommand
|
|
158
158
|
open_incidents = json_response["openIncidents"]
|
159
159
|
if open_incidents && !open_incidents.empty?
|
160
160
|
print_h2 "Open Incidents"
|
161
|
-
|
162
|
-
|
163
|
-
# todo: move this to MonitoringHelper ?
|
164
|
-
# print_incidents_table(issues, options)
|
161
|
+
print_incidents_table(open_incidents)
|
162
|
+
# print_results_pagination(size: open_incidents.size, total: open_incidents.size)
|
165
163
|
else
|
166
164
|
print "\n", cyan
|
167
165
|
puts "No open incidents for this monitoring app"
|
@@ -154,10 +154,8 @@ class Morpheus::Cli::MonitoringGroupsCommand
|
|
154
154
|
open_incidents = json_response["openIncidents"]
|
155
155
|
if open_incidents && !open_incidents.empty?
|
156
156
|
print_h2 "Open Incidents"
|
157
|
-
|
158
|
-
|
159
|
-
# todo: move this to MonitoringHelper ?
|
160
|
-
# print_incidents_table(issues, options)
|
157
|
+
print_incidents_table(open_incidents)
|
158
|
+
# print_results_pagination(size: open_incidents.size, total: open_incidents.size)
|
161
159
|
else
|
162
160
|
print "\n", cyan
|
163
161
|
puts "No open incidents for this check group"
|
data/lib/morpheus/cli/tasks.rb
CHANGED
@@ -130,6 +130,30 @@ class Morpheus::Cli::Tasks
|
|
130
130
|
"Name" => 'name',
|
131
131
|
"Code" => 'code',
|
132
132
|
"Type" => lambda {|it| it['taskType']['name'] },
|
133
|
+
"Execute Target" => lambda {|it|
|
134
|
+
if it['executeTarget'] == 'local'
|
135
|
+
git_info = []
|
136
|
+
if it['taskOptions']
|
137
|
+
if it['taskOptions']['localScriptGitId']
|
138
|
+
git_info << "Git Repo: #{it['taskOptions']['localScriptGitId']}"
|
139
|
+
end
|
140
|
+
if it['taskOptions']['localScriptGitRef']
|
141
|
+
git_info << "Git Ref: #{it['taskOptions']['localScriptGitRef']}"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
"Local #{git_info.join(', ')}"
|
145
|
+
elsif it['executeTarget'] == 'remote'
|
146
|
+
remote_url = ""
|
147
|
+
if it['taskOptions']
|
148
|
+
remote_url = "#{it['taskOptions']['username']}@#{it['taskOptions']['host']}:#{it['taskOptions']['port']}"
|
149
|
+
end
|
150
|
+
"Remote #{remote_url}"
|
151
|
+
elsif it['executeTarget'] == 'resource'
|
152
|
+
"Resource"
|
153
|
+
else
|
154
|
+
it['executeTarget']
|
155
|
+
end
|
156
|
+
},
|
133
157
|
"Result Type" => 'resultType',
|
134
158
|
"Retryable" => lambda {|it|
|
135
159
|
if it['retryable']
|
@@ -137,7 +161,7 @@ class Morpheus::Cli::Tasks
|
|
137
161
|
else
|
138
162
|
format_boolean(it['retryable'])
|
139
163
|
end
|
140
|
-
|
164
|
+
},
|
141
165
|
}
|
142
166
|
print_description_list(description_cols, task)
|
143
167
|
|
@@ -218,7 +242,7 @@ class Morpheus::Cli::Tasks
|
|
218
242
|
exit 1
|
219
243
|
end
|
220
244
|
else
|
221
|
-
|
245
|
+
print_green_success "Task #{response['task']['name']} updated"
|
222
246
|
get([task['id']])
|
223
247
|
end
|
224
248
|
rescue RestClient::Exception => e
|
@@ -284,25 +308,50 @@ class Morpheus::Cli::Tasks
|
|
284
308
|
task_code = val
|
285
309
|
end
|
286
310
|
opts.on('--result-type VALUE', String, "Result Type" ) do |val|
|
287
|
-
options[:options] ||= {}
|
288
311
|
options[:options]['resultType'] = val
|
289
312
|
end
|
313
|
+
opts.on('--result-type VALUE', String, "Result Type" ) do |val|
|
314
|
+
options[:options]['executeTarget'] = val
|
315
|
+
end
|
316
|
+
opts.on('--execute-target VALUE', String, "Execute Target" ) do |val|
|
317
|
+
options[:options]['executeTarget'] = val
|
318
|
+
end
|
319
|
+
opts.on('--target-host VALUE', String, "Target Host" ) do |val|
|
320
|
+
options[:options]['taskOptions'] ||= {}
|
321
|
+
options[:options]['taskOptions']['host'] = val
|
322
|
+
end
|
323
|
+
opts.on('--target-port VALUE', String, "Target Port" ) do |val|
|
324
|
+
options[:options]['taskOptions'] ||= {}
|
325
|
+
options[:options]['taskOptions']['port'] = val
|
326
|
+
end
|
327
|
+
opts.on('--target-username VALUE', String, "Target Username" ) do |val|
|
328
|
+
options[:options]['taskOptions'] ||= {}
|
329
|
+
options[:options]['taskOptions']['username'] = val
|
330
|
+
end
|
331
|
+
opts.on('--target-password VALUE', String, "Target Password" ) do |val|
|
332
|
+
options[:options]['taskOptions'] ||= {}
|
333
|
+
options[:options]['taskOptions']['password'] = val
|
334
|
+
end
|
335
|
+
opts.on('--git-repo VALUE', String, "Git Repo ID" ) do |val|
|
336
|
+
options[:options]['taskOptions'] ||= {}
|
337
|
+
options[:options]['taskOptions']['localScriptGitId'] = val
|
338
|
+
end
|
339
|
+
opts.on('--git-ref VALUE', String, "Git Ref" ) do |val|
|
340
|
+
options[:options]['taskOptions'] ||= {}
|
341
|
+
options[:options]['taskOptions']['localScriptGitRef'] = val
|
342
|
+
end
|
290
343
|
opts.on('--retryable [on|off]', String, "Retryable" ) do |val|
|
291
|
-
options[:options] ||= {}
|
292
344
|
options[:options]['retryable'] = val.to_s == 'on' || val.to_s == 'true' || val == '' || val.nil?
|
293
345
|
end
|
294
346
|
opts.on('--retry-count COUNT', String, "Retry Count" ) do |val|
|
295
|
-
options[:options] ||= {}
|
296
347
|
options[:options]['retryCount'] = val.to_i
|
297
348
|
end
|
298
349
|
opts.on('--retry-delay SECONDS', String, "Retry Delay Seconds" ) do |val|
|
299
|
-
options[:options] ||= {}
|
300
350
|
options[:options]['retryDelaySeconds'] = val.to_i
|
301
351
|
end
|
302
352
|
opts.on('--file FILE', "File containing the script. This can be used instead of --O taskOptions.script" ) do |filename|
|
303
353
|
full_filename = File.expand_path(filename)
|
304
354
|
if File.exists?(full_filename)
|
305
|
-
options[:options] ||= {}
|
306
355
|
options[:options]['taskOptions'] ||= {}
|
307
356
|
options[:options]['taskOptions']['script'] = File.read(full_filename)
|
308
357
|
# params['script'] = File.read(full_filename)
|
@@ -312,7 +361,6 @@ class Morpheus::Cli::Tasks
|
|
312
361
|
end
|
313
362
|
# use the filename as the name by default.
|
314
363
|
if !options[:options]['name']
|
315
|
-
options[:options] ||= {}
|
316
364
|
options[:options]['name'] = File.basename(full_filename)
|
317
365
|
end
|
318
366
|
end
|
@@ -375,9 +423,9 @@ class Morpheus::Cli::Tasks
|
|
375
423
|
task_types_dropdown = @all_task_types.collect {|it| {"name" => it["name"], "value" => it["code"]}}
|
376
424
|
|
377
425
|
if task_type_name
|
378
|
-
#payload['task']['taskType'] =
|
426
|
+
#payload['task']['taskType'] = task_type_name
|
379
427
|
else
|
380
|
-
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => task_types_dropdown}], options[:options], @api_client)
|
428
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'type', 'fieldLabel' => 'Type', 'type' => 'select', 'selectOptions' => task_types_dropdown, 'required' => true}], options[:options], @api_client)
|
381
429
|
task_type_name = v_prompt['type']
|
382
430
|
end
|
383
431
|
|
@@ -391,8 +439,8 @@ class Morpheus::Cli::Tasks
|
|
391
439
|
|
392
440
|
|
393
441
|
# Result Type
|
394
|
-
if
|
395
|
-
payload['task']['resultType'] =
|
442
|
+
if options[:options]['resultType']
|
443
|
+
payload['task']['resultType'] = options[:options]['resultType']
|
396
444
|
else
|
397
445
|
result_types_dropdown = [{"name" => "Value", "value" => "value"}, {"name" => "Exit Code", "value" => "exitCode"}, {"name" => "Key Value", "value" => "keyValue"}, {"name" => "JSON", "value" => "json"}]
|
398
446
|
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'resultType', 'fieldLabel' => 'Result Type', 'type' => 'select', 'selectOptions' => result_types_dropdown}], options[:options], @api_client)
|
@@ -413,6 +461,72 @@ class Morpheus::Cli::Tasks
|
|
413
461
|
payload.deep_merge!({'task' => input_options}) unless input_options.empty?
|
414
462
|
|
415
463
|
|
464
|
+
# Target Options
|
465
|
+
|
466
|
+
if options[:options]['executeTarget'] != nil
|
467
|
+
payload['task']['executeTarget'] = options[:options]['executeTarget']
|
468
|
+
else
|
469
|
+
default_target = nil
|
470
|
+
execute_targets_dropdown = []
|
471
|
+
if task_type['allowExecuteLocal']
|
472
|
+
default_target = 'local'
|
473
|
+
execute_targets_dropdown << {"name" => "Local", "value" => "local"}
|
474
|
+
end
|
475
|
+
if task_type['allowExecuteRemote']
|
476
|
+
default_target = 'remote'
|
477
|
+
execute_targets_dropdown << {"name" => "Remote", "value" => "remote"}
|
478
|
+
end
|
479
|
+
if task_type['allowExecuteResource']
|
480
|
+
default_target = 'resource'
|
481
|
+
execute_targets_dropdown << {"name" => "Resource", "value" => "resource"}
|
482
|
+
end
|
483
|
+
if !execute_targets_dropdown.empty?
|
484
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'executeTarget', 'fieldLabel' => 'Execute Target', 'type' => 'select', 'selectOptions' => execute_targets_dropdown, 'defaultValue' => default_target, 'required' => true}], options[:options], @api_client)
|
485
|
+
payload['task']['executeTarget'] = v_prompt['executeTarget'].to_s unless v_prompt['executeTarget'].to_s.empty?
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
if payload['task']['executeTarget'] == 'local'
|
490
|
+
# Git Repo
|
491
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => 'taskOptions', 'fieldName' => 'localScriptGitId', 'fieldLabel' => 'Git Repo', 'type' => 'text', 'description' => 'Git Repo ID'}], options[:options], @api_client)
|
492
|
+
if v_prompt['taskOptions'] && !v_prompt['taskOptions']['localScriptGitId'].to_s.empty?
|
493
|
+
payload['task']['taskOptions'] ||= {}
|
494
|
+
payload['task']['taskOptions']['localScriptGitId'] = v_prompt['taskOptions']['localScriptGitId']
|
495
|
+
end
|
496
|
+
# Git Ref
|
497
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => 'taskOptions', 'fieldName' => 'localScriptGitRef', 'fieldLabel' => 'Git Ref', 'type' => 'text', 'description' => 'Git Ref eg. master'}], options[:options], @api_client)
|
498
|
+
if v_prompt['taskOptions'] && !v_prompt['taskOptions']['localScriptGitRef'].to_s.empty?
|
499
|
+
payload['task']['taskOptions'] ||= {}
|
500
|
+
payload['task']['taskOptions']['localScriptGitRef'] = v_prompt['taskOptions']['localScriptGitRef']
|
501
|
+
end
|
502
|
+
|
503
|
+
elsif payload['task']['executeTarget'] == 'remote'
|
504
|
+
# Host
|
505
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => 'taskOptions', 'fieldName' => 'host', 'fieldLabel' => 'IP Address', 'type' => 'text', 'description' => 'IP Address / Host for remote execution'}], options[:options], @api_client)
|
506
|
+
if v_prompt['taskOptions'] && !v_prompt['taskOptions']['host'].to_s.empty?
|
507
|
+
payload['task']['taskOptions'] ||= {}
|
508
|
+
payload['task']['taskOptions']['host'] = v_prompt['taskOptions']['host']
|
509
|
+
end
|
510
|
+
# Port
|
511
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => 'taskOptions', 'fieldName' => 'port', 'fieldLabel' => 'Port', 'type' => 'text', 'description' => 'Port for remote execution', 'defaultValue' => '22'}], options[:options], @api_client)
|
512
|
+
if v_prompt['taskOptions'] && !v_prompt['taskOptions']['port'].to_s.empty?
|
513
|
+
payload['task']['taskOptions'] ||= {}
|
514
|
+
payload['task']['taskOptions']['port'] = v_prompt['taskOptions']['port']
|
515
|
+
end
|
516
|
+
# Host
|
517
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => 'taskOptions', 'fieldName' => 'username', 'fieldLabel' => 'Username', 'type' => 'text', 'description' => 'Username for remote execution'}], options[:options], @api_client)
|
518
|
+
if v_prompt['taskOptions'] && !v_prompt['taskOptions']['username'].to_s.empty?
|
519
|
+
payload['task']['taskOptions'] ||= {}
|
520
|
+
payload['task']['taskOptions']['username'] = v_prompt['taskOptions']['username']
|
521
|
+
end
|
522
|
+
# Host
|
523
|
+
v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => 'taskOptions', 'fieldName' => 'password', 'fieldLabel' => 'Password', 'type' => 'password', 'description' => 'Password for remote execution'}], options[:options], @api_client)
|
524
|
+
if v_prompt['taskOptions'] && !v_prompt['taskOptions']['password'].to_s.empty?
|
525
|
+
payload['task']['taskOptions'] ||= {}
|
526
|
+
payload['task']['taskOptions']['password'] = v_prompt['taskOptions']['password']
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
416
530
|
|
417
531
|
# Retryable
|
418
532
|
if options[:options]['retryable'] != nil
|
@@ -454,7 +568,7 @@ class Morpheus::Cli::Tasks
|
|
454
568
|
print JSON.pretty_generate(json_response),"\n"
|
455
569
|
elsif !options[:quiet]
|
456
570
|
task = json_response['task']
|
457
|
-
|
571
|
+
print_green_success "Task #{task['name']} created successfully"
|
458
572
|
get([task['id']])
|
459
573
|
end
|
460
574
|
rescue RestClient::Exception => e
|
@@ -495,7 +609,7 @@ class Morpheus::Cli::Tasks
|
|
495
609
|
if options[:json]
|
496
610
|
print JSON.pretty_generate(json_response),"\n"
|
497
611
|
elsif !options[:quiet]
|
498
|
-
|
612
|
+
print_green_success "Task #{task['name']} removed"
|
499
613
|
end
|
500
614
|
rescue RestClient::Exception => e
|
501
615
|
print_rest_exception(e, options)
|
data/lib/morpheus/cli/version.rb
CHANGED
@@ -370,7 +370,16 @@ class Morpheus::Cli::VirtualImages
|
|
370
370
|
|
371
371
|
if image_type_name
|
372
372
|
image_type = virtual_image_type_for_name_or_code(image_type_name)
|
373
|
-
|
373
|
+
# fix issue with api returning imageType vmware instead of vmdk
|
374
|
+
if image_type.nil? && image_type_name == 'vmware'
|
375
|
+
image_type = virtual_image_type_for_name_or_code('vmdk')
|
376
|
+
elsif image_type.nil? && image_type_name == 'vmdk'
|
377
|
+
image_type = virtual_image_type_for_name_or_code('vmware')
|
378
|
+
end
|
379
|
+
if image_type.nil?
|
380
|
+
print_red_alert "Virtual Image Type not found by code '#{image_type_name}'"
|
381
|
+
return 1
|
382
|
+
end
|
374
383
|
# options[:options] ||= {}
|
375
384
|
# options[:options]['imageType'] ||= image_type['code']
|
376
385
|
else
|
@@ -399,6 +408,10 @@ class Morpheus::Cli::VirtualImages
|
|
399
408
|
if tenants_list
|
400
409
|
virtual_image_payload['accounts'] = tenants_list
|
401
410
|
end
|
411
|
+
# fix issue with api returning imageType vmware instead of vmdk
|
412
|
+
if virtual_image_payload && virtual_image_payload['imageType'] == 'vmware'
|
413
|
+
virtual_image_payload['imageType'] == 'vmdk'
|
414
|
+
end
|
402
415
|
payload = {virtualImage: virtual_image_payload}
|
403
416
|
@virtual_images_interface.setopts(options)
|
404
417
|
if options[:dry_run]
|
@@ -652,7 +665,8 @@ class Morpheus::Cli::VirtualImages
|
|
652
665
|
end
|
653
666
|
return @available_virtual_image_types
|
654
667
|
end
|
655
|
-
|
668
|
+
|
669
|
+
def virtual_image_type_for_name_or_code(name)
|
656
670
|
return get_available_virtual_image_types().find { |z| z['name'].downcase == name.downcase || z['code'].downcase == name.downcase}
|
657
671
|
end
|
658
672
|
|
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: 3.6.
|
4
|
+
version: 3.6.38
|
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: 2019-07-
|
14
|
+
date: 2019-07-25 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|