morpheus-cli 4.1.10 → 4.1.11

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: '090c9aa2420e68bbded20a8277e475990ce50a2b45adc63cb93d9d3f2fb3cf79'
4
- data.tar.gz: e60d21d206cdf6de9a8658597e3f2bfa58cb193693306029df243755384247b5
3
+ metadata.gz: eeb2d7ec5bf66114a982cf7167ffbc735298681c111d32b5763250ee517c8c63
4
+ data.tar.gz: 2cba59bb697b00839d91d1c86caa3bdd843c9728b359ddc7559c53df76d7432f
5
5
  SHA512:
6
- metadata.gz: eae9a2c5fea6a4da28738c130ed8d4087aece62b6770ec15a19ce8bfe845b05fe78be2ced93d62d9dacc2ae895359a6eebd126a7941b8cdb8ee546f2943b8f4b
7
- data.tar.gz: dff2a2f2511f56b9f4da2b278f3cd49aacc7dea276b711a484c8448115abf3db9d743a0db2bf9ea7c5c9ce1aa5bff51fdcf83e604e3c8d2ce6b892dbe4eef3de
6
+ metadata.gz: c369bb2c1db1042532cd5c8ba443c0a3cb1d4a6da31267a1ef0b3f907add7f02f6e13c616ce9f264c77a7501ff277bf3f83f11cb20977b202d693e7c24cae194
7
+ data.tar.gz: 4554a65db783b20932aa54677b7b0811a3692543f1654c0bdc9e8f9b77496d71adb5e9b00a7cf0c21bdbf6372249cf044cd8f9b71865cab74e4ea973a997b97b
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.5.1
2
2
 
3
- RUN gem install morpheus-cli -v 4.1.9
3
+ RUN gem install morpheus-cli -v 4.1.11
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -26,14 +26,14 @@ class Morpheus::NetworksInterface < Morpheus::APIClient
26
26
  def create(payload)
27
27
  url = "#{@base_url}/api/networks"
28
28
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
29
- opts = {method: :post, url: url, headers: headers, payload: payload.to_json}
29
+ opts = {method: :post, url: url, headers: headers, payload: payload.to_json, timeout: 300}
30
30
  execute(opts)
31
31
  end
32
32
 
33
33
  def update(id, payload)
34
34
  url = "#{@base_url}/api/networks/#{id}"
35
35
  headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' }
36
- opts = {method: :put, url: url, headers: headers, payload: payload.to_json}
36
+ opts = {method: :put, url: url, headers: headers, payload: payload.to_json, timeout: 300}
37
37
  execute(opts)
38
38
  end
39
39
 
@@ -491,7 +491,7 @@ class Morpheus::Cli::Instances
491
491
  params['powerScheduleType'] = val == "null" ? nil : val
492
492
  end
493
493
  opts.on('--created-by ID', String, "Created By User ID") do |val|
494
- params['createdById'] = val
494
+ options[:created_by_id] = val
495
495
  end
496
496
  build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote])
497
497
  end
@@ -543,13 +543,16 @@ class Morpheus::Cli::Instances
543
543
  payload['instance'].deep_merge!(params)
544
544
  end
545
545
  else
546
- if params.empty?
546
+ if params.empty? && options[:created_by_id].nil?
547
547
  print_red_alert "Specify at least one option to update"
548
548
  puts optparse
549
549
  exit 1
550
550
  end
551
551
  payload = {}
552
552
  payload['instance'] = params
553
+ if options[:created_by_id]
554
+ payload['createdById'] = options[:created_by_id].to_i
555
+ end
553
556
  end
554
557
  @instances_interface.setopts(options)
555
558
  if options[:dry_run]
@@ -199,13 +199,14 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
199
199
  short_name: container['shortName'],
200
200
  version: container['containerVersion'],
201
201
  category: container['category'],
202
- count: server['nodeCount']
202
+ count: server['nodeCount'],
203
+ priority: server['priorityOrder']
203
204
  }
204
205
  end
205
206
 
206
207
  if nodes.count > 0
207
208
  print_h2 "#{node_type.capitalize} Nodes"
208
- puts as_pretty_table(nodes, [:id, :name, :short_name, :version, :category, :count])
209
+ puts as_pretty_table(nodes, [:id, :name, :short_name, :version, :category, :count, :priority])
209
210
  end
210
211
  end
211
212
  print reset,"\n"
@@ -266,10 +267,10 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
266
267
  opts.on('-o', '--option-types LIST', Array, "Option types, comma separated list of option type IDs") do |val|
267
268
  options[:optionTypes] = val
268
269
  end
269
- opts.on('--masters LIST', Array, "List of master. Comma separated container types IDs in format id[/count], ex: 100,101/3") do |val|
270
+ opts.on('--masters LIST', Array, "List of master. Comma separated container types IDs in format id[/count/priority], ex: 100,101/3/0") do |val|
270
271
  options[:masters] = val
271
272
  end
272
- opts.on('--workers LIST', Array, "List of workers. Comma separated container types IDs in format id[/count], ex: 100,101/3") do |val|
273
+ opts.on('--workers LIST', Array, "List of workers. Comma separated container types IDs in format id[/count/priority], ex: 100,101/3/1") do |val|
273
274
  options[:workers] = val
274
275
  end
275
276
  build_common_options(opts, options, [:options, :payload, :json, :dry_run, :remote])
@@ -412,34 +413,38 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
412
413
  params['optionTypes'] = option_types if option_types
413
414
 
414
415
  # nodes
416
+ priority = 0
415
417
  ['master', 'worker'].each do |node_type|
416
418
  nodes = []
417
419
  if cluster_type["has#{node_type.capitalize}s"]
418
420
  if options["#{node_type}s".to_sym]
419
421
  options["#{node_type}s".to_sym].each do |container_type_id|
420
- count = 1
422
+ node_count = 1
421
423
  if container_type_id.include?('/')
422
424
  parts = container_type_id.split('/')
423
425
  container_type_id = parts[0]
424
- count = parts[1].to_i if parts.count > 1
426
+ node_count = parts[1].to_i if parts.count > 1
427
+ priority = parts[2].to_i if parts.count > 2
425
428
  end
426
429
 
427
430
  if @library_container_types_interface.get(nil, container_type_id.to_i).nil?
428
431
  print_red_alert "Container type #{container_type_id} not found"
429
432
  exit 1
430
433
  else
431
- nodes << {'nodeCount' => count, 'containerType' => {'id' => container_type_id.to_i}}
434
+ nodes << {'nodeCount' => node_count, 'priorityOrder' => priority, 'containerType' => {'id' => container_type_id.to_i}}
432
435
  end
433
436
  end
434
437
  else
435
438
  avail_container_types = @library_container_types_interface.list(nil, {'technology' => provision_type['code'], 'max' => 1000})['containerTypes'].collect {|it| {'name' => it['name'], 'value' => it['id']}}
436
439
  while !avail_container_types.empty? && Morpheus::Cli::OptionTypes.confirm("Add #{nodes.empty? ? '' : 'another '}#{node_type} node?", {:default => false}) do
437
440
  container_type_id = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'value', 'type' => 'select', 'fieldLabel' => "#{node_type.capitalize} Node", 'selectOptions' => avail_container_types, 'required' => true}],options[:options],@api_client,{}, options[:no_prompt], true)['value']
438
- count = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'value', 'type' => 'number', 'fieldLabel' => "#{node_type.capitalize} Node Count", 'required' => true, 'defaultValue' => 1}], options[:options], @api_client, {}, options[:no_prompt])['value']
439
- nodes << {'nodeCount' => count, 'containerType' => {'id' => container_type_id.to_i}}
441
+ node_count = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'value', 'type' => 'number', 'fieldLabel' => "#{node_type.capitalize} Node Count", 'required' => true, 'defaultValue' => 1}], options[:options], @api_client, {}, options[:no_prompt])['value']
442
+ priority = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'value', 'type' => 'number', 'fieldLabel' => "#{node_type.capitalize} Priority", 'required' => true, 'defaultValue' => priority}], options[:options], @api_client, {}, options[:no_prompt])['value']
443
+ nodes << {'nodeCount' => node_count, 'priorityOrder' => priority, 'containerType' => {'id' => container_type_id.to_i}}
440
444
  avail_container_types.reject! {|it| it['value'] == container_type_id}
441
445
  end
442
446
  end
447
+ priority += 1
443
448
  end
444
449
  params["#{node_type}s"] = nodes
445
450
  end
@@ -526,13 +531,13 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
526
531
  opts.on(nil, '--clear-opt-types', "Removes all options") do
527
532
  params['optionTypes'] = []
528
533
  end
529
- opts.on('--masters LIST', Array, "List of master nodes. Comma separated container types IDs in format id[/count], ex: 100,101/3") do |val|
534
+ opts.on('--masters LIST', Array, "List of master. Comma separated container types IDs in format id[/count/priority], ex: 100,101/3/0") do |val|
530
535
  options[:masters] = val
531
536
  end
532
537
  opts.on('--clear-masters', Array, "Removes all master nodes") do
533
538
  params['masters'] = []
534
539
  end
535
- opts.on('--workers LIST', Array, "List of workers. Comma separated container types IDs in format id[/count], ex: 100,101/3") do |val|
540
+ opts.on('--workers LIST', Array, "List of workers. Comma separated container types IDs in format id[/count/priority], ex: 100,101/3/1") do |val|
536
541
  options[:workers] = val
537
542
  end
538
543
  opts.on('--clear-workers', Array, "Removes all worker nodes") do
@@ -619,18 +624,22 @@ class Morpheus::Cli::LibraryClusterLayoutsCommand
619
624
  exit 1
620
625
  else
621
626
  options["#{node_type}s".to_sym].each do |container_type_id|
622
- count = 1
627
+ node_count = 1
628
+ priority = nil
623
629
  if container_type_id.include?('/')
624
630
  parts = container_type_id.split('/')
625
631
  container_type_id = parts[0]
626
- count = parts[1].to_i if parts.count > 1
632
+ node_count = parts[1].to_i if parts.count > 1
633
+ priority = parts[2].to_i if parts.count > 2
627
634
  end
628
635
 
629
636
  if @library_container_types_interface.get(nil, container_type_id.to_i).nil?
630
637
  print_red_alert "Container type #{container_type_id} not found"
631
638
  exit 1
632
639
  else
633
- nodes << {'nodeCount' => count, 'containerType' => {'id' => container_type_id.to_i}}
640
+ node = {'nodeCount' => node_count, 'containerType' => {'id' => container_type_id.to_i}}
641
+ node['priorityOrder'] = priority if !priority.nil?
642
+ nodes << node
634
643
  end
635
644
  end
636
645
  end
@@ -41,17 +41,8 @@ class Morpheus::Cli::LibraryResourceSpecsCommand
41
41
  end
42
42
  # do it
43
43
  json_response = @resource_specs_interface.list(params)
44
- # print result and return output
45
- if options[:json]
46
- puts as_json(json_response, options, "specs")
47
- return 0
48
- elsif options[:csv]
49
- puts records_as_csv(json_response['specTemplates'], options)
50
- return 0
51
- elsif options[:yaml]
52
- puts as_yaml(json_response, options, "specs")
53
- return 0
54
- end
44
+ render_result = render_with_format(json_response, options, 'specTemplates')
45
+ return 0 if render_result
55
46
  resource_specs = json_response['specTemplates']
56
47
  title = "Morpheus Library - Resource Spec Templates"
57
48
  subtitles = []
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "4.1.10"
4
+ VERSION = "4.1.11"
5
5
  end
6
6
  end
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: 4.1.10
4
+ version: 4.1.11
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: 2020-01-23 00:00:00.000000000 Z
14
+ date: 2020-01-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -438,7 +438,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
438
438
  - !ruby/object:Gem::Version
439
439
  version: '0'
440
440
  requirements: []
441
- rubygems_version: 3.0.6
441
+ rubyforge_project:
442
+ rubygems_version: 2.7.6
442
443
  signing_key:
443
444
  specification_version: 4
444
445
  summary: Provides CLI Interface to the Morpheus Public/Private Cloud Appliance