nex_client 0.15.0.pre1 → 0.15.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6596e2a8eccfe2e5d1a0054ecf642bca67d6d56
4
- data.tar.gz: bbf86956bcc6faac34a728b6db4278de2d93b213
3
+ metadata.gz: 4623d879686e7a0ba5588bb81ff60fccb49166f0
4
+ data.tar.gz: 9ecb670afcc265e4ddbbbdef066e44616b42f47a
5
5
  SHA512:
6
- metadata.gz: 5e868e2ddcd3176f509aacfd58902ca31273ba97c998603242fff6875eff33d234abb4f177e93aeeefe2f574035023631c42ab2aa7b71aaa6b0e7638a6545775
7
- data.tar.gz: 079862bc6e1112454e209b589fdb4ae167e5658bd381656a8e2551d644a531b84ad83aab4ce4c4c2e3ddb7bc8f465423011d8f89a5de48c7ecf59b8702d003a7
6
+ metadata.gz: 57621a0f904473f7db5edb7cd9c41d345cc4eab5d18e3168e8395d75618f11bce68a5b60e36ab440b01ee0af5ce83e2512b70005fa45e0f3e65366aaf2e5b938
7
+ data.tar.gz: 634af28770112f3ae4e3cd19cca0ea36e2a02544b7c8d64cb3f8f0716459d7258d9f204ec9540bbec2089eccfb7b89810186288f532e1f35c47de33155217307
@@ -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'
@@ -54,7 +54,7 @@ module NexClient
54
54
  self.display_addons(e)
55
55
 
56
56
  # Display all vars
57
- self.display_vars(e.all_vars)
57
+ self.display_vars(e.all_vars,!opts.full_vars)
58
58
 
59
59
  # Display options
60
60
  self.display_options(e.opts) if e.respond_to?(:opts)
@@ -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 { |k,v| t.add_row([k,v]) }
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
- record.container_status,
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
- events = NexClient::Event.paginate(per_page: opts.tail || 50).where(filters).order(created_at: :desc)
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"
@@ -1,3 +1,3 @@
1
1
  module NexClient
2
- VERSION ||= '0.15.0.pre1'
2
+ VERSION ||= '0.15.0.pre2'
3
3
  end
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.pre1
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-05 00:00:00.000000000 Z
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