morpheus-cli 3.3.1.2 → 3.3.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e733c8e17b5f716f3ddbc77cfd4f4a4edcd4829
4
- data.tar.gz: a84c8fe72b59941c634cb7fb9cd65d50f09baf77
3
+ metadata.gz: 6dca5394d3b291c04ad94c20fd9070c3edf671c1
4
+ data.tar.gz: 0ff1d952e7bb43abab664b76070fa6e3caf0040b
5
5
  SHA512:
6
- metadata.gz: 4ef7d578657dceaf7d2eb8ab41386af3d344e8df567f41d05034c8d44a7fef43271e3d7f95f691c2fe461098b17e6b63713df97cdd95f33783e35d564c542000
7
- data.tar.gz: 16b13439ac6db6a6ea4267a8e09dbd53c2d10f6e3ce78e7c2b5a7a767a067aab06ed005cdffb67077ad78ac9c015848a40ce46378bb694a0baacfa9e4c693ad2
6
+ metadata.gz: 180055da960a32d3f91d62c0e14d3b2f17bff1d62583bed8996e1c293f032813e4a8cce9b31b61516ab633cbc4bbc727b75eeb3acaf8cc3761f156113984b648
7
+ data.tar.gz: 81f35079f2e9bb2996326aa3cc2b6a054985618202c9dfd50730f556ade6a5111994c596614f4a5061d74aceeba021bff4f5ee5bf591fd30f6920cd59e73bef0
@@ -92,6 +92,7 @@ class Morpheus::Cli::Apps
92
92
  end
93
93
 
94
94
  def add(args)
95
+ template_id = nil
95
96
  options = {}
96
97
  optparse = Morpheus::Cli::OptionParser.new do |opts|
97
98
  opts.banner = subcommand_usage("[name] [options]")
@@ -157,8 +158,23 @@ class Morpheus::Cli::Apps
157
158
  payload = {}
158
159
  params = Morpheus::Cli::OptionTypes.prompt(add_app_option_types, options[:options], @api_client, options[:params])
159
160
  params = params.deep_compact! # remove nulls and blank strings
160
- if params['template']
161
- params['id'] = params.delete('template')
161
+ template_id = params.delete('template')
162
+ if template_id.to_s.empty? || template_id == 'existing'
163
+ # new API parameter
164
+ payload['templateId'] = 'existing'
165
+ # API versions before 3.3.1 expect both of these instead of templateId
166
+ payload['id'] = 'existing'
167
+ payload['templateName'] = 'Existing Instances'
168
+ else
169
+ found_app_template = get_available_app_templates.find {|it| it['id'].to_s == template_id.to_s }
170
+ if found_app_template.nil?
171
+ print_red_alert "App Template not found by id #{template_id}"
172
+ return 1
173
+ end
174
+ payload['templateId'] = found_app_template['id']
175
+ # API versions before 3.3.1 expect both of these instead of templateId
176
+ payload['id'] = found_app_template['id']
177
+ payload['templateName'] = found_app_template['name']
162
178
  end
163
179
  group = find_group_by_name_or_id_for_provisioning(params.delete('group'))
164
180
  return if group.nil?
@@ -166,17 +182,6 @@ class Morpheus::Cli::Apps
166
182
  payload['group'] = {id: group['id'], name: group['name']}
167
183
  end
168
184
 
169
- # allow creating a blank app by default
170
- # sux having go merge this into user passed config/configFile
171
- # but it's better than making them know to enter it.
172
- if !payload['id']
173
- payload['id'] = 'existing'
174
- payload['templateName'] = 'Existing Instances'
175
- else
176
- # maybe validate template id
177
- # app_template = find_app_template_by_id(payload['id'])
178
- end
179
-
180
185
  if options[:dry_run]
181
186
  print_dry_run @apps_interface.dry.create(payload)
182
187
  return
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "3.3.1.2"
4
+ VERSION = "3.3.1.3"
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.3.1.2
4
+ version: 3.3.1.3
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: 2018-03-30 00:00:00.000000000 Z
14
+ date: 2018-03-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler