morpheus-cli 4.2.7 → 4.2.8

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
  SHA256:
3
- metadata.gz: 126814172818496eedcb013dedfd88920675f1646b924b1304aa89986b4883d7
4
- data.tar.gz: 936e0252a66ee0cd7ad99c691b87ed4e3a608ffd38810fccf4673c79dc53b47f
3
+ metadata.gz: 39ea88743d6ad4977058a608249545bffa88dfdd0bec6c80b23cd73d904cbf3d
4
+ data.tar.gz: 5b775dd9bdb4652c381c8166721560b5b49d9f5f4a64055bd51ef80189072ca6
5
5
  SHA512:
6
- metadata.gz: 72ee705d6fa646418aa223fe6ba2ab2558850a8a949ab8d821018878c3288c486bde5175c2ce8d360db8587f5db9a1bd0e760af900216ec9fb82b407270648f2
7
- data.tar.gz: 6bb390e9947db29cf1e5ead6ea4c1de0ff4f78b11268247616354d677d42b838edf9e87ffc976f75423576b98509bb98462630ce48020300cb3e749a6b4f5f01
6
+ metadata.gz: 00cbddb0b701321221a396758a1a344028c9e02608dfe5a1e8ea8ddc834a02c52b9ddb76b99b9a226f933763c5cefee9c22a07198262f6f57216edb2eb1f844f
7
+ data.tar.gz: bd44a4e080bdac78a9c6aae481f61c749041527332ccf09881e72ba63c8359bfb7658d05e9204ac957d8453314893bca24fb63d232007e1ab406bc23071854bf
data/Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
1
  FROM ruby:2.5.1
2
2
 
3
- RUN gem install morpheus-cli -v 4.2.7
3
+ RUN gem install morpheus-cli -v 4.2.8
4
4
 
5
5
  ENTRYPOINT ["morpheus"]
@@ -423,6 +423,13 @@ module Morpheus::Cli::ProvisioningHelper
423
423
  arbitrary_options.delete('environment')
424
424
  arbitrary_options.delete('instanceContext')
425
425
  arbitrary_options.delete('tags')
426
+ # these are used by prompt_network_interfaces
427
+ arbitrary_options.delete('networkInterface')
428
+ (2..10).each {|i| arbitrary_options.delete('networkInterface' + i.to_s) }
429
+ # these are used by prompt_volumes
430
+ arbitrary_options.delete('rootVolume')
431
+ arbitrary_options.delete('dataVolume')
432
+ (2..10).each {|i| arbitrary_options.delete('dataVolume' + i.to_s) }
426
433
  arbitrary_options.delete('lockedFields')
427
434
  # arbitrary_options.delete('ports')
428
435
  payload.deep_merge!(arbitrary_options)
@@ -223,25 +223,49 @@ class Morpheus::Cli::Users
223
223
  }
224
224
  print_description_list(description_cols, user)
225
225
 
226
- available_field_options = {'features' => 'Feature', 'sites' => 'Group', 'zones' => 'Cloud', 'instance_types' => 'Instance Type', 'app_templates' => 'Blueprint'}
227
- available_field_options.each do |field, label|
228
- if !(field == 'sites' && is_tenant_account) && options["include_#{field}_access".to_sym]
229
- access = user['access'][field.split('_').enum_for(:each_with_index).collect {|word, idx| idx == 0 ? word : word.capitalize}.join]
230
- access = access.reject {|it| it['access'] == 'none'} if !options[:display_none_access]
226
+ # backward compatibility
227
+ if user['access'].nil? && options[:include_features_access]
228
+ user_feature_permissions_json = @users_interface.feature_permissions(account_id, user['id'])
229
+ user_feature_permissions = user_feature_permissions_json['permissions'] || user_feature_permissions_json['featurePermissions']
231
230
 
232
- print_h2 "#{label} Access", options
231
+ if user_feature_permissions
232
+ print_h2 "Feature Permissions", options
233
233
  print cyan
234
-
235
- if access.count > 0
236
- access.each {|it| it['access'] = get_access_string(it['access'])}
237
-
238
- if ['features', 'instance_types'].include?(field)
239
- print as_pretty_table(access, [:name, :code, :access], options)
240
- else
241
- print as_pretty_table(access, [:name, :access], options)
234
+ if user_feature_permissions.is_a?(Array)
235
+ rows = user_feature_permissions.collect do |it|
236
+ {name: it['name'], code: it['code'], access: get_access_string(it['access']) }
242
237
  end
238
+ print as_pretty_table(rows, [:name, :code, :access], options)
243
239
  else
244
- println yellow,"No #{label} Access Found.",reset
240
+ rows = user_feature_permissions.collect do |code, access|
241
+ {code: code, access: get_access_string(access) }
242
+ end
243
+ print as_pretty_table(rows, [:code, :access], options)
244
+ end
245
+ else
246
+ puts yellow,"No permissions found.",reset
247
+ end
248
+ else
249
+ available_field_options = {'features' => 'Feature', 'sites' => 'Group', 'zones' => 'Cloud', 'instance_types' => 'Instance Type', 'app_templates' => 'Blueprint'}
250
+ available_field_options.each do |field, label|
251
+ if !(field == 'sites' && is_tenant_account) && options["include_#{field}_access".to_sym]
252
+ access = user['access'][field.split('_').enum_for(:each_with_index).collect {|word, idx| idx == 0 ? word : word.capitalize}.join]
253
+ access = access.reject {|it| it['access'] == 'none'} if !options[:display_none_access]
254
+
255
+ print_h2 "#{label} Access", options
256
+ print cyan
257
+
258
+ if access.count > 0
259
+ access.each {|it| it['access'] = get_access_string(it['access'])}
260
+
261
+ if ['features', 'instance_types'].include?(field)
262
+ print as_pretty_table(access, [:name, :code, :access], options)
263
+ else
264
+ print as_pretty_table(access, [:name, :access], options)
265
+ end
266
+ else
267
+ println yellow,"No #{label} Access Found.",reset
268
+ end
245
269
  end
246
270
  end
247
271
  end
@@ -287,38 +311,74 @@ class Morpheus::Cli::Users
287
311
 
288
312
  json_response = @users_interface.permissions(account_id, user['id'])
289
313
 
290
- if options[:json]
291
- puts as_json(json_response, options, 'access')
292
- return 0
293
- elsif options[:yaml]
294
- puts as_yaml(json_response, options, 'access')
295
- return 0
296
- elsif options[:csv]
297
- puts records_as_csv(json_response['access'], options)
298
- return 0
299
- end
314
+ # backward compatibility
315
+ if !json_response['permissions'].nil?
316
+ if options[:json]
317
+ puts as_json(json_response, options, 'permissions')
318
+ return 0
319
+ elsif options[:yaml]
320
+ puts as_yaml(json_response, options, 'permissions')
321
+ return 0
322
+ elsif options[:csv]
323
+ puts records_as_csv(json_response['permissions'], options)
324
+ return 0
325
+ else
326
+ user_feature_permissions = nil
327
+ # permissions (Array) has replaced featurePermissions (map)
328
+ user_feature_permissions = json_response['permissions'] || json_response['featurePermissions']
329
+ print_h1 "User Permissions: #{user['username']}", options
330
+ if user_feature_permissions
331
+ print cyan
332
+ if user_feature_permissions.is_a?(Array)
333
+ rows = user_feature_permissions.collect do |it|
334
+ {name: it['name'], code: it['code'], access: get_access_string(it['access']) }
335
+ end
336
+ print as_pretty_table(rows, [:name, :code, :access], options)
337
+ else
338
+ rows = user_feature_permissions.collect do |code, access|
339
+ {code: code, access: get_access_string(access) }
340
+ end
341
+ print as_pretty_table(rows, [:code, :access], options)
342
+ end
343
+
344
+ else
345
+ print yellow,"No permissions found.",reset,"\n"
346
+ end
347
+ end
348
+ else
349
+ if options[:json]
350
+ puts as_json(json_response, options, 'access')
351
+ return 0
352
+ elsif options[:yaml]
353
+ puts as_yaml(json_response, options, 'access')
354
+ return 0
355
+ elsif options[:csv]
356
+ puts records_as_csv(json_response['access'], options)
357
+ return 0
358
+ end
300
359
 
301
- print_h1 "User Permissions: #{user['username']}", options
360
+ print_h1 "User Permissions: #{user['username']}", options
302
361
 
303
- available_field_options = {'features' => 'Feature', 'sites' => 'Group', 'zones' => 'Cloud', 'instance_types' => 'Instance Type', 'app_templates' => 'Blueprint'}
304
- available_field_options.each do |field, label|
305
- if !(field == 'sites' && is_tenant_account)
306
- access = json_response['access'][field.split('_').enum_for(:each_with_index).collect {|word, idx| idx == 0 ? word : word.capitalize}.join]
307
- access = access.reject {|it| it['access'] == 'none'} if !options[:display_none_access]
362
+ available_field_options = {'features' => 'Feature', 'sites' => 'Group', 'zones' => 'Cloud', 'instance_types' => 'Instance Type', 'app_templates' => 'Blueprint'}
363
+ available_field_options.each do |field, label|
364
+ if !(field == 'sites' && is_tenant_account)
365
+ access = json_response['access'][field.split('_').enum_for(:each_with_index).collect {|word, idx| idx == 0 ? word : word.capitalize}.join]
366
+ access = access.reject {|it| it['access'] == 'none'} if !options[:display_none_access]
308
367
 
309
- print_h2 "#{label} Access", options
310
- print cyan
368
+ print_h2 "#{label} Access", options
369
+ print cyan
311
370
 
312
- if access.count > 0
313
- access.each {|it| it['access'] = get_access_string(it['access'])}
371
+ if access.count > 0
372
+ access.each {|it| it['access'] = get_access_string(it['access'])}
314
373
 
315
- if ['features', 'instance_types'].include?(field)
316
- print as_pretty_table(access, [:name, :code, :access], options)
374
+ if ['features', 'instance_types'].include?(field)
375
+ print as_pretty_table(access, [:name, :code, :access], options)
376
+ else
377
+ print as_pretty_table(access, [:name, :access], options)
378
+ end
317
379
  else
318
- print as_pretty_table(access, [:name, :access], options)
380
+ println yellow,"No #{label} Access Found.",reset
319
381
  end
320
- else
321
- println yellow,"No #{label} Access Found.",reset
322
382
  end
323
383
  end
324
384
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Morpheus
3
3
  module Cli
4
- VERSION = "4.2.7"
4
+ VERSION = "4.2.8"
5
5
  end
6
6
  end
@@ -29,15 +29,24 @@ class Morpheus::Cli::Workflows
29
29
 
30
30
 
31
31
  def list(args)
32
+ params = {}
32
33
  options = {}
33
34
  optparse = Morpheus::Cli::OptionParser.new do |opts|
34
35
  opts.banner = subcommand_usage()
36
+ opts.on("-t", "--type TYPE", "Type of workflow. i.e. provision or operation. Default is provision.") do |val|
37
+ workflow_type = val.to_s.downcase
38
+ if workflow_type.include?('provision')
39
+ workflow_type = 'provision'
40
+ elsif workflow_type.include?('operation')
41
+ workflow_type = 'operation'
42
+ end
43
+ params['type'] = workflow_type
44
+ end
35
45
  build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
36
46
  end
37
47
  optparse.parse!(args)
38
48
  connect(options)
39
49
  begin
40
- params = {}
41
50
  params.merge!(parse_list_options(options))
42
51
  @task_sets_interface.setopts(options)
43
52
  if options[:dry_run]
@@ -61,6 +70,9 @@ class Morpheus::Cli::Workflows
61
70
  title = "Morpheus Workflows"
62
71
  subtitles = []
63
72
  subtitles += parse_list_subtitles(options)
73
+ if params['type']
74
+ subtitles << "Type: #{params['type']}"
75
+ end
64
76
  print_h1 title, subtitles
65
77
  if task_sets.empty?
66
78
  print cyan,"No workflows found.",reset,"\n"
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.2.7
4
+ version: 4.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Estes