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 +4 -4
- data/Dockerfile +1 -1
- data/lib/morpheus/cli/mixins/provisioning_helper.rb +7 -0
- data/lib/morpheus/cli/users.rb +100 -40
- data/lib/morpheus/cli/version.rb +1 -1
- data/lib/morpheus/cli/workflows.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39ea88743d6ad4977058a608249545bffa88dfdd0bec6c80b23cd73d904cbf3d
|
4
|
+
data.tar.gz: 5b775dd9bdb4652c381c8166721560b5b49d9f5f4a64055bd51ef80189072ca6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00cbddb0b701321221a396758a1a344028c9e02608dfe5a1e8ea8ddc834a02c52b9ddb76b99b9a226f933763c5cefee9c22a07198262f6f57216edb2eb1f844f
|
7
|
+
data.tar.gz: bd44a4e080bdac78a9c6aae481f61c749041527332ccf09881e72ba63c8359bfb7658d05e9204ac957d8453314893bca24fb63d232007e1ab406bc23071854bf
|
data/Dockerfile
CHANGED
@@ -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)
|
data/lib/morpheus/cli/users.rb
CHANGED
@@ -223,25 +223,49 @@ class Morpheus::Cli::Users
|
|
223
223
|
}
|
224
224
|
print_description_list(description_cols, user)
|
225
225
|
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
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
|
-
|
231
|
+
if user_feature_permissions
|
232
|
+
print_h2 "Feature Permissions", options
|
233
233
|
print cyan
|
234
|
-
|
235
|
-
|
236
|
-
|
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
|
-
|
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
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
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
|
-
|
360
|
+
print_h1 "User Permissions: #{user['username']}", options
|
302
361
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
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
|
-
|
310
|
-
|
368
|
+
print_h2 "#{label} Access", options
|
369
|
+
print cyan
|
311
370
|
|
312
|
-
|
313
|
-
|
371
|
+
if access.count > 0
|
372
|
+
access.each {|it| it['access'] = get_access_string(it['access'])}
|
314
373
|
|
315
|
-
|
316
|
-
|
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
|
-
|
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
|
data/lib/morpheus/cli/version.rb
CHANGED
@@ -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"
|