morpheus-cli 3.6.13 → 3.6.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/morpheus/cli/apps.rb +14 -9
- data/lib/morpheus/cli/hosts.rb +11 -6
- data/lib/morpheus/cli/instances.rb +12 -7
- data/lib/morpheus/cli/tenants_command.rb +13 -9
- data/lib/morpheus/cli/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aec984aa936c4514cf97141863e02468799a227e98d1f09862a5f7be773cd512
|
4
|
+
data.tar.gz: d491b1541ae9e74d02ba9857a475b7ab15ac7eac0901c55937bb07b5d953be71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d1da2f8325d05492b0e03ce8a28e7a6301361b84ce78526761de0a86a78a1d2003e11abb2fb00b4f520016cbef8a3b9a4b72aee85fe7034d9cf33505bf3b7f4
|
7
|
+
data.tar.gz: 1916a80f9e8b895806e40f3c29f47139b2cf2d97ad91bef6f91e000bb8233defcd71725bc09cd986e0730eba39aff45667afd9d4891e142709c39966f8da934d
|
data/lib/morpheus/cli/apps.rb
CHANGED
@@ -51,6 +51,9 @@ class Morpheus::Cli::Apps
|
|
51
51
|
opts.on( '--created-by USER', "Created By User Username or ID" ) do |val|
|
52
52
|
options[:created_by] = val
|
53
53
|
end
|
54
|
+
opts.on('--details', "Display more details: memory and storage usage used / max values." ) do
|
55
|
+
options[:details] = true
|
56
|
+
end
|
54
57
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
55
58
|
opts.footer = "List apps."
|
56
59
|
end
|
@@ -1474,9 +1477,9 @@ class Morpheus::Cli::Apps
|
|
1474
1477
|
end
|
1475
1478
|
end
|
1476
1479
|
|
1477
|
-
def print_apps_table(apps,
|
1480
|
+
def print_apps_table(apps, options={})
|
1478
1481
|
|
1479
|
-
table_color =
|
1482
|
+
table_color = options[:color] || cyan
|
1480
1483
|
rows = apps.collect do |app|
|
1481
1484
|
tiers_str = format_app_tiers(app)
|
1482
1485
|
instances_str = (app['instanceCount'].to_i == 1) ? "1 Instance" : "#{app['instanceCount']} Instances"
|
@@ -1486,12 +1489,14 @@ class Morpheus::Cli::Apps
|
|
1486
1489
|
cpu_usage_str = !stats ? "" : generate_usage_bar((stats['cpuUsage'] || stats['cpuUsagePeak']).to_f, 100, {max_bars: 10})
|
1487
1490
|
memory_usage_str = !stats ? "" : generate_usage_bar(stats['usedMemory'], stats['maxMemory'], {max_bars: 10})
|
1488
1491
|
storage_usage_str = !stats ? "" : generate_usage_bar(stats['usedStorage'], stats['maxStorage'], {max_bars: 10})
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1492
|
+
if options[:details]
|
1493
|
+
if stats['maxMemory'] && stats['maxMemory'].to_i != 0
|
1494
|
+
memory_usage_str = memory_usage_str + cyan + format_bytes_short(stats['usedMemory']).strip.rjust(8, ' ') + " / " + format_bytes_short(stats['maxMemory']).strip
|
1495
|
+
end
|
1496
|
+
if stats['maxStorage'] && stats['maxStorage'].to_i != 0
|
1497
|
+
storage_usage_str = storage_usage_str + cyan + format_bytes_short(stats['usedStorage']).strip.rjust(8, ' ') + " / " + format_bytes_short(stats['maxStorage']).strip
|
1498
|
+
end
|
1499
|
+
end
|
1495
1500
|
{
|
1496
1501
|
id: app['id'],
|
1497
1502
|
name: app['name'],
|
@@ -1528,7 +1533,7 @@ class Morpheus::Cli::Apps
|
|
1528
1533
|
# columns = options[:include_fields]
|
1529
1534
|
# end
|
1530
1535
|
# print cyan
|
1531
|
-
print as_pretty_table(rows, columns,
|
1536
|
+
print as_pretty_table(rows, columns, options) #{color: table_color}
|
1532
1537
|
print reset,"\n"
|
1533
1538
|
end
|
1534
1539
|
|
data/lib/morpheus/cli/hosts.rb
CHANGED
@@ -96,6 +96,9 @@ class Morpheus::Cli::Hosts
|
|
96
96
|
opts.on( '--created-by USER', "Created By User Username or ID" ) do |val|
|
97
97
|
options[:created_by] = val
|
98
98
|
end
|
99
|
+
opts.on('--details', "Display more details: memory and storage usage used / max values." ) do
|
100
|
+
options[:details] = true
|
101
|
+
end
|
99
102
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
100
103
|
opts.footer = "List hosts."
|
101
104
|
end
|
@@ -193,12 +196,14 @@ class Morpheus::Cli::Hosts
|
|
193
196
|
cpu_usage_str = !stats ? "" : generate_usage_bar((stats['usedCpu'] || stats['cpuUsage']).to_f, 100, {max_bars: 10})
|
194
197
|
memory_usage_str = !stats ? "" : generate_usage_bar(stats['usedMemory'], stats['maxMemory'], {max_bars: 10})
|
195
198
|
storage_usage_str = !stats ? "" : generate_usage_bar(stats['usedStorage'], stats['maxStorage'], {max_bars: 10})
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
199
|
+
if options[:details]
|
200
|
+
if stats['maxMemory'] && stats['maxMemory'].to_i != 0
|
201
|
+
memory_usage_str = memory_usage_str + cyan + format_bytes_short(stats['usedMemory']).strip.rjust(8, ' ') + " / " + format_bytes_short(stats['maxMemory']).strip
|
202
|
+
end
|
203
|
+
if stats['maxStorage'] && stats['maxStorage'].to_i != 0
|
204
|
+
storage_usage_str = storage_usage_str + cyan + format_bytes_short(stats['usedStorage']).strip.rjust(8, ' ') + " / " + format_bytes_short(stats['maxStorage']).strip
|
205
|
+
end
|
206
|
+
end
|
202
207
|
row = {
|
203
208
|
id: server['id'],
|
204
209
|
tenant: server['account'] ? server['account']['name'] : server['accountId'],
|
@@ -62,6 +62,9 @@ class Morpheus::Cli::Instances
|
|
62
62
|
opts.on( '--created-by USER', "Created By User Username or ID" ) do |val|
|
63
63
|
options[:created_by] = val
|
64
64
|
end
|
65
|
+
opts.on('--details', "Display more details: memory and storage usage used / max values." ) do
|
66
|
+
options[:details] = true
|
67
|
+
end
|
65
68
|
build_common_options(opts, options, [:list, :query, :json, :yaml, :csv, :fields, :dry_run, :remote])
|
66
69
|
opts.footer = "List instances."
|
67
70
|
end
|
@@ -157,12 +160,14 @@ class Morpheus::Cli::Instances
|
|
157
160
|
cpu_usage_str = !stats ? "" : generate_usage_bar((stats['usedCpu'] || stats['cpuUsage']).to_f, 100, {max_bars: 10})
|
158
161
|
memory_usage_str = !stats ? "" : generate_usage_bar(stats['usedMemory'], stats['maxMemory'], {max_bars: 10})
|
159
162
|
storage_usage_str = !stats ? "" : generate_usage_bar(stats['usedStorage'], stats['maxStorage'], {max_bars: 10})
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
163
|
+
if options[:details]
|
164
|
+
if stats['maxMemory'] && stats['maxMemory'].to_i != 0
|
165
|
+
memory_usage_str = memory_usage_str + cyan + format_bytes_short(stats['usedMemory']).strip.rjust(8, ' ') + " / " + format_bytes_short(stats['maxMemory']).strip
|
166
|
+
end
|
167
|
+
if stats['maxStorage'] && stats['maxStorage'].to_i != 0
|
168
|
+
storage_usage_str = storage_usage_str + cyan + format_bytes_short(stats['usedStorage']).strip.rjust(8, ' ') + " / " + format_bytes_short(stats['maxStorage']).strip
|
169
|
+
end
|
170
|
+
end
|
166
171
|
row = {
|
167
172
|
id: instance['id'],
|
168
173
|
name: instance['name'],
|
@@ -2781,7 +2786,7 @@ class Morpheus::Cli::Instances
|
|
2781
2786
|
opts.on( nil, '--output', "Display process output." ) do
|
2782
2787
|
options[:show_output] = true
|
2783
2788
|
end
|
2784
|
-
opts.on(
|
2789
|
+
opts.on('--details', "Display more details: memory and storage usage used / max values." ) do
|
2785
2790
|
options[:show_events] = true
|
2786
2791
|
options[:show_output] = true
|
2787
2792
|
options[:details] = true
|
@@ -229,8 +229,12 @@ class Morpheus::Cli::TenantsCommand
|
|
229
229
|
|
230
230
|
def update(args)
|
231
231
|
options = {}
|
232
|
+
params = {}
|
232
233
|
optparse = Morpheus::Cli::OptionParser.new do |opts|
|
233
234
|
opts.banner = subcommand_usage("[name] [options]")
|
235
|
+
opts.on('--active [on|off]', String, "Can be used to disable a network") do |val|
|
236
|
+
params['active'] = val.to_s.empty? || val.to_s == 'on' || val.to_s == 'true'
|
237
|
+
end
|
234
238
|
build_option_type_options(opts, options, update_account_option_types)
|
235
239
|
build_common_options(opts, options, [:options, :json, :remote, :dry_run])
|
236
240
|
end
|
@@ -246,7 +250,7 @@ class Morpheus::Cli::TenantsCommand
|
|
246
250
|
exit 1 if account.nil?
|
247
251
|
|
248
252
|
#params = Morpheus::Cli::OptionTypes.prompt(update_account_option_types, options[:options], @api_client, options[:params])
|
249
|
-
params
|
253
|
+
params.deep_merge!(options[:options].reject {|k,v| k.is_a?(Symbol) }) if options[:options]
|
250
254
|
|
251
255
|
if params.empty?
|
252
256
|
puts optparse
|
@@ -254,15 +258,15 @@ class Morpheus::Cli::TenantsCommand
|
|
254
258
|
end
|
255
259
|
|
256
260
|
#puts "parsed params is : #{params.inspect}"
|
257
|
-
account_keys = ['name', 'description', 'currency', 'instanceLimits']
|
258
|
-
account_payload = params
|
261
|
+
#account_keys = ['name', 'description', 'currency', 'instanceLimits']
|
262
|
+
account_payload = params
|
259
263
|
account_payload['currency'] = account_payload['currency'].upcase unless account_payload['currency'].to_s.empty?
|
260
|
-
if !account_payload['instanceLimits']
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
end
|
264
|
+
# if !account_payload['instanceLimits']
|
265
|
+
# account_payload['instanceLimits'] = {}
|
266
|
+
# account_payload['instanceLimits']['maxStorage'] = params['instanceLimits.maxStorage'].to_i if params['instanceLimits.maxStorage'].to_s.strip != ''
|
267
|
+
# account_payload['instanceLimits']['maxMemory'] = params['instanceLimits.maxMemory'].to_i if params['instanceLimits.maxMemory'].to_s.strip != ''
|
268
|
+
# account_payload['instanceLimits']['maxCpu'] = params['instanceLimits.maxCpu'].to_i if params['instanceLimits.maxCpu'].to_s.strip != ''
|
269
|
+
# end
|
266
270
|
if params['role'].to_s != ''
|
267
271
|
role = find_role_by_name(nil, params['role'])
|
268
272
|
exit 1 if role.nil?
|
data/lib/morpheus/cli/version.rb
CHANGED
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.
|
4
|
+
version: 3.6.14
|
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-02-
|
14
|
+
date: 2019-02-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|