morpheus-cli 3.6.24 → 3.6.25

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: 4d79e052f4783588f17ce7a97a26b04c974fd5ed06c43177fcececad2c9c58b1
4
- data.tar.gz: 0440f108209b955081e05ec0512296910bd4c364afded4cc816100d6ac4867a0
3
+ metadata.gz: d5d560e8e83081efac41b0771522d543965ad22b5ad58391961f08c1f90a3696
4
+ data.tar.gz: 2a257d25fb63d46f2124c78eebfc8769a3de2b7e6329e48a6d12368f49ca6251
5
5
  SHA512:
6
- metadata.gz: 2968f363d3ead95dcd556f47e2769ab7f32d33056eef9e61ace8abd91c9c46e41d8e59274160f3e5885935a7110c401a7634069e8de8aeac041928007fe797f2
7
- data.tar.gz: aa78c0182612ab3b894b7c8f93805b8e4f029a5bda249bdfeaa9f09f6b12f36393b05be455053e60e67eb3b540b5ef5b4d28d0695c6143516fba8787749e1b3d
6
+ metadata.gz: 7e9c4bb406ef1254080c48039036475d6561f94e965b889f96de523afbfc2ca724f170f7109cb84db1bdb8b268c1b978e4041ab2c49c875907b2fa7ac027fff5
7
+ data.tar.gz: dd8377ea9e349bcaa9dedf0339f344e5f11c763d310861c81f9bef83b45f8a9a430204ea30d84cd8e1795d11393e21f8f2e4d55a18f4808cbfeeeebbc0b67f3e
@@ -239,7 +239,7 @@ class Morpheus::Cli::Apps
239
239
  else
240
240
  blueprint = find_blueprint_by_name_or_id(blueprint_id)
241
241
  if blueprint.nil?
242
- print_red_alert "Blueprint not found by name or id '#{blueprint_id}'"
242
+ #print_red_alert "Blueprint not found by name or id '#{blueprint_id}'"
243
243
  return 1
244
244
  end
245
245
  end
@@ -371,9 +371,9 @@ class Morpheus::Cli::Apps
371
371
  instance_prompt_options[:cloud] = cloud ? cloud['name'] : nil
372
372
  instance_prompt_options[:default_cloud] = cloud ? cloud['name'] : nil
373
373
  instance_prompt_options[:no_prompt] = options[:no_prompt]
374
- instance_prompt_options[:always_prompt] = options[:no_prompt] != true # options[:always_prompt]
374
+ #instance_prompt_options[:always_prompt] = options[:no_prompt] != true # options[:always_prompt]
375
375
  instance_prompt_options[:options] = scoped_instance_config # meh, actually need to make these default values instead..
376
- instance_prompt_options[:options][:always_prompt] = instance_prompt_options[:no_prompt] != true
376
+ #instance_prompt_options[:options][:always_prompt] = instance_prompt_options[:no_prompt] != true
377
377
  instance_prompt_options[:options][:no_prompt] = instance_prompt_options[:no_prompt]
378
378
 
379
379
  # also allow arbritrary options passed as tierName.instanceIndex like Web.0.instance.layout.id=75
@@ -289,6 +289,7 @@ module Morpheus::Cli::ProvisioningHelper
289
289
  arbitrary_options.delete('cloud')
290
290
  arbitrary_options.delete('type')
291
291
  arbitrary_options.delete('name')
292
+ arbitrary_options.delete('version')
292
293
  arbitrary_options.delete('layout')
293
294
  arbitrary_options.delete('servicePlan')
294
295
  arbitrary_options.delete('description')
@@ -314,7 +315,28 @@ module Morpheus::Cli::ProvisioningHelper
314
315
 
315
316
  # Version and Layout
316
317
 
317
- version_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'version', 'type' => 'select', 'fieldLabel' => 'Version', 'optionSource' => 'instanceVersions', 'required' => true, 'skipSingleOption' => true, 'autoPickOption' => true, 'description' => 'Select which version of the instance type to be provisioned.'}],options[:options],api_client,{groupId: group_id, cloudId: cloud_id, instanceTypeId: instance_type['id']})
318
+ available_versions = options_interface.options_for_source('instanceVersions',{groupId: group_id, cloudId: cloud_id, instanceTypeId: instance_type['id']})['data']
319
+ default_version_value = payload['instance']['version'] ? payload['instance']['version'] : payload['version']
320
+ default_layout_value = payload['instance']['layout'] ? payload['instance']['layout']['id'] : nil
321
+ # JD: version is always nil because it is not stored in the blueprint or config !!
322
+ # so for now, infer the version from the layout
323
+ # requires api 3.6.2 to get "layouts" from /options/versions
324
+ if default_layout_value && default_version_value.to_s.empty?
325
+ available_versions.each do |available_version|
326
+ if available_version["layouts"]
327
+ selected_layout = available_version["layouts"].find {|it| it["value"].to_s == default_layout_value.to_s || it["id"].to_s == default_layout_value.to_s || it["code"].to_s == default_layout_value.to_s }
328
+ if selected_layout
329
+ default_version_value = available_version["value"]
330
+ break
331
+ end
332
+ end
333
+ end
334
+ end
335
+
336
+ # do not require version if a layout is passed
337
+ version_is_required = !!default_layout_value
338
+ #version_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'version', 'type' => 'select', 'fieldLabel' => 'Version', 'optionSource' => 'instanceVersions', 'required' => true, 'skipSingleOption' => true, 'autoPickOption' => true, 'description' => 'Select which version of the instance type to be provisioned.', 'defaultValue' => default_version_value}],options[:options],api_client,{groupId: group_id, cloudId: cloud_id, instanceTypeId: instance_type['id']})
339
+ version_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'version', 'type' => 'select', 'fieldLabel' => 'Version', 'selectOptions' => available_versions, 'required' => version_is_required, 'skipSingleOption' => true, 'autoPickOption' => true, 'description' => 'Select which version of the instance type to be provisioned.', 'defaultValue' => default_version_value}],options[:options],api_client,{groupId: group_id, cloudId: cloud_id, instanceTypeId: instance_type['id']})
318
340
  default_layout_value = payload['instance']['layout'] ? payload['instance']['layout']['id'] : nil
319
341
  layout_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldName' => 'layout', 'type' => 'select', 'fieldLabel' => 'Layout', 'optionSource' => 'layoutsForCloud', 'required' => true, 'description' => 'Select which configuration of the instance type to be provisioned.', 'defaultValue' => default_layout_value}],options[:options],api_client,{groupId: group_id, cloudId: cloud_id, instanceTypeId: instance_type['id'], version: version_prompt['version']})
320
342
  layout_id = layout_prompt['layout']
@@ -511,11 +533,11 @@ module Morpheus::Cli::ProvisioningHelper
511
533
  storage_type_id = nil
512
534
  storage_type = nil
513
535
  else
514
- v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageType', 'type' => 'select', 'fieldLabel' => 'Root Storage Type', 'selectOptions' => root_storage_types, 'required' => true, 'skipSingleOption' => true, 'description' => 'Choose a storage type.'}], options[:options])
536
+ v_prompt = Morpheus::Cli::OptionTypes.prompt([{'fieldContext' => field_context, 'fieldName' => 'storageType', 'type' => 'select', 'fieldLabel' => 'Root Storage Type', 'selectOptions' => root_storage_types, 'required' => true, 'skipSingleOption' => true, 'description' => 'Choose a storage type.', 'defaultValue' => volume['storageType']}], options[:options])
515
537
  storage_type_id = v_prompt[field_context]['storageType']
516
538
  storage_type = plan_info['storageTypes'].find {|i| i['id'] == storage_type_id.to_i }
539
+ volume['storageType'] = storage_type_id
517
540
  end
518
- volume['storageType'] = storage_type_id
519
541
 
520
542
  # sometimes the user chooses sizeId from a list of size options (AccountPrice) and other times it is free form
521
543
  root_custom_size_options = []
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "3.6.24"
4
+ VERSION = "3.6.25"
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: 3.6.24
4
+ version: 3.6.25
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-03-28 00:00:00.000000000 Z
14
+ date: 2019-04-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler