nex_client 0.15.0.pre1 → 0.15.0.pre2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4623d879686e7a0ba5588bb81ff60fccb49166f0
|
4
|
+
data.tar.gz: 9ecb670afcc265e4ddbbbdef066e44616b42f47a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57621a0f904473f7db5edb7cd9c41d345cc4eab5d18e3168e8395d75618f11bce68a5b60e36ab440b01ee0af5ce83e2512b70005fa45e0f3e65366aaf2e5b938
|
7
|
+
data.tar.gz: 634af28770112f3ae4e3cd19cca0ea36e2a02544b7c8d64cb3f8f0716459d7258d9f204ec9540bbec2089eccfb7b89810186288f532e1f35c47de33155217307
|
data/lib/nex_client/cli.rb
CHANGED
@@ -83,6 +83,7 @@ module NexClient
|
|
83
83
|
c.summary = 'Show information about an addon'
|
84
84
|
c.description = 'Show all details about an addon'
|
85
85
|
c.example 'show details about myaddon', 'nex-cli addons:info myaddon'
|
86
|
+
c.option '--full-vars', 'do not truncate environment variables'
|
86
87
|
c.action do |args, options|
|
87
88
|
NexClient::Commands::Addons.info(args,options)
|
88
89
|
end
|
@@ -215,6 +216,7 @@ module NexClient
|
|
215
216
|
c.summary = 'Show information about an app'
|
216
217
|
c.description = 'Show all details about an app'
|
217
218
|
c.example 'show details about myapp', 'nex-cli apps:info myapp'
|
219
|
+
c.option '--full-vars', 'do not truncate environment variables'
|
218
220
|
c.action do |args, options|
|
219
221
|
NexClient::Commands::Apps.info(args,options)
|
220
222
|
end
|
@@ -312,6 +314,7 @@ module NexClient
|
|
312
314
|
c.example 'Add env variables to myapp from file and prefix all vars with foo (foo_myvar)', 'nex-cli apps:vars myapp --env-file ~/myenvfile --env-prefix foo'
|
313
315
|
c.option '--add MYVAR=value,MYVAR2=value,...', Array, 'comma separated list of env variables'
|
314
316
|
c.option '--delete MYVAR,MYVAR2,...', Array, 'comma separated list of env variables'
|
317
|
+
c.option '--full-vars', 'do not truncate environment variables'
|
315
318
|
c.option '--env-file FILE', String, 'newline separated list of env variables (MYVAR=1) or YAML file. Note that YAML parsing is recursive.'
|
316
319
|
c.option '--env-prefix PREFIX', String, 'prefix all variables contained in the env file with the specified prefix (PREFIX_MYVAR)'
|
317
320
|
c.option '--raw', 'vars are returned in a environment file format (key=value)'
|
@@ -370,10 +373,7 @@ module NexClient
|
|
370
373
|
c.example 'list cube xyz', 'nex-cli cubes --name xyz'
|
371
374
|
c.option '--all', 'list all cubes (no filtering)'
|
372
375
|
c.option '--status <provisioning|running|stopped|terminated>', String, 'list all cubes in a given status'
|
373
|
-
c.option '--ssl', 'list all cubes with SSL enabled'
|
374
376
|
c.option '--storage', 'list all cubes with persistent storage'
|
375
|
-
c.option '--soa', 'list all apps with soa enabled [legacy]'
|
376
|
-
c.option '--dns DNS_NAME', 'list cube by dns (xyz.domain.com) or root dns (xyz)'
|
377
377
|
c.option '--app APP_NAME', 'list all cubes attached to the specified app'
|
378
378
|
c.option '--addon ADDON_NAME', 'list all cubes attached to the specified addon'
|
379
379
|
c.option '--owner HANDLE', 'list all cubes for the specified owner'
|
@@ -60,7 +60,7 @@ module NexClient
|
|
60
60
|
self.display_apps(e)
|
61
61
|
|
62
62
|
# Display all vars
|
63
|
-
self.display_vars(e.all_vars)
|
63
|
+
self.display_vars(e.all_vars,!opts.full_vars)
|
64
64
|
|
65
65
|
# Display options
|
66
66
|
self.display_options(e.opts) if e.respond_to?(:opts)
|
@@ -344,7 +344,7 @@ module NexClient
|
|
344
344
|
if opts.raw
|
345
345
|
self.display_raw_vars(e.all_vars)
|
346
346
|
else
|
347
|
-
self.display_vars(e.all_vars)
|
347
|
+
self.display_vars(e.all_vars,!opts.full_vars)
|
348
348
|
end
|
349
349
|
end
|
350
350
|
|
@@ -405,10 +405,13 @@ module NexClient
|
|
405
405
|
puts "\n"
|
406
406
|
end
|
407
407
|
|
408
|
-
def self.display_vars(list)
|
408
|
+
def self.display_vars(list,truncate = true)
|
409
409
|
table = Terminal::Table.new title: VARS_TITLE, headings: VARS_HEADERS do |t|
|
410
410
|
[list].flatten.compact.each do |e|
|
411
|
-
e.sort_by { |k, v| k }.each
|
411
|
+
e.sort_by { |k, v| k }.each do |k,v|
|
412
|
+
val = truncate ? v.to_s.truncate(100) : v
|
413
|
+
t.add_row([k,val])
|
414
|
+
end
|
412
415
|
end
|
413
416
|
end
|
414
417
|
puts table
|
@@ -10,15 +10,12 @@ module NexClient
|
|
10
10
|
def self.list(args,opts)
|
11
11
|
filters = {}
|
12
12
|
filters[:status] = opts.status if opts.status.present?
|
13
|
-
filters[:soa_enabled] = opts.soa if opts.soa.present?
|
14
|
-
filters[:ssl_enabled] = opts.ssl if opts.ssl.present?
|
15
13
|
filters[:persistent_storage] = opts.storage if opts.storage.present?
|
16
14
|
|
17
15
|
# All option
|
18
16
|
filters = {} if opts.all
|
19
17
|
|
20
18
|
# Identification options
|
21
|
-
filters[:dns] = opts.dns if opts.dns.present?
|
22
19
|
filters[:'app.name'] = opts.app if opts.app.present?
|
23
20
|
filters[:'addon.name'] = opts.addon if opts.addon.present?
|
24
21
|
|
@@ -98,12 +95,12 @@ module NexClient
|
|
98
95
|
end
|
99
96
|
|
100
97
|
def self.format_record(record)
|
101
|
-
dns = self.format_dns(record)
|
102
98
|
cluster = self.format_cluster(record)
|
99
|
+
container_status = record.respond_to?(:container_status) ? record.container_status : '-'
|
103
100
|
[
|
104
101
|
record.uuid,
|
105
102
|
record.status,
|
106
|
-
|
103
|
+
container_status,
|
107
104
|
record.region,
|
108
105
|
record.persistent_storage,
|
109
106
|
record.ip_address || '-',
|
@@ -112,10 +109,6 @@ module NexClient
|
|
112
109
|
]
|
113
110
|
end
|
114
111
|
|
115
|
-
def self.format_dns(record)
|
116
|
-
record.dns || '-'
|
117
|
-
end
|
118
|
-
|
119
112
|
def self.format_cluster(record)
|
120
113
|
return '-' unless o = record.cluster
|
121
114
|
"#{o.type.singularize}:#{o.name}"
|
@@ -36,14 +36,23 @@ module NexClient
|
|
36
36
|
filters = {}
|
37
37
|
filters[:'source.name'] = args.first
|
38
38
|
filters[:event] = opts.type if opts.type
|
39
|
+
tail_size = (opts.tail || 50).to_i
|
40
|
+
|
41
|
+
events = NexClient::Event.where(filters).order(id: :desc)
|
42
|
+
list = events.to_a
|
43
|
+
while list.count < tail_size
|
44
|
+
events = events.pages.next
|
45
|
+
break unless events
|
46
|
+
list |= events.to_a
|
47
|
+
end
|
48
|
+
list = list.first(tail_size)
|
39
49
|
|
40
|
-
|
41
|
-
self.display_events(events.to_a)
|
50
|
+
self.display_events(list.to_a)
|
42
51
|
end
|
43
52
|
|
44
53
|
# Display a list of events
|
45
54
|
def display_events(events)
|
46
|
-
events.sort_by { |e| e.id }.each do |e|
|
55
|
+
events.sort_by { |e| e.id.to_i }.each do |e|
|
47
56
|
puts [e.created_at,e.event.ljust(12,' '),e.level.ljust(6,' '),e.message].join(" | ")
|
48
57
|
end
|
49
58
|
puts "\n"
|
data/lib/nex_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nex_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.0.
|
4
|
+
version: 0.15.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Lachaume
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|