kontena-cli 1.3.1 → 1.3.2.rc1
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/VERSION +1 -1
- data/lib/kontena/cli/containers/exec_command.rb +1 -1
- data/lib/kontena/cli/helpers/exec_helper.rb +2 -2
- data/lib/kontena/cli/nodes/list_command.rb +1 -1
- data/lib/kontena/cli/services/exec_command.rb +1 -1
- data/spec/kontena/cli/nodes/list_command_spec.rb +4 -2
- data/spec/kontena/cli/table_generator_spec.rb +4 -0
- data/spec/support/output_helpers.rb +17 -15
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '09dd9aa199b2377f60c7fd461743a5512cc6ad13'
|
|
4
|
+
data.tar.gz: 81eec9b635ccc3d4207224a9c6c5acefcfb6cc59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27ba045edeccbb29fa363edfc57e77ddd7f7adea2db57f1842e4735a6145a16d22040ac078363e78d81542e03a840192ea176b54e3bbed5e08545e322a83d980
|
|
7
|
+
data.tar.gz: '0328929022b14facc2ccd0642345c218411124192dca88405a5e95437914ee0411d87f41bddc6a9e22839fb8957586da89eccbc9e3ec6000910f5379d13b2f85'
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.3.
|
|
1
|
+
1.3.2.rc1
|
|
@@ -29,7 +29,7 @@ module Kontena::Cli::Containers
|
|
|
29
29
|
end
|
|
30
30
|
ws.on :open do
|
|
31
31
|
ws.text(cmd)
|
|
32
|
-
stdin_reader = self.stream_stdin_to_ws(ws) if self.interactive?
|
|
32
|
+
stdin_reader = self.stream_stdin_to_ws(ws, tty: self.tty?) if self.interactive?
|
|
33
33
|
end
|
|
34
34
|
ws.on :close do |e|
|
|
35
35
|
if e.reason.include?('code: 404')
|
|
@@ -5,10 +5,10 @@ module Kontena::Cli::Helpers
|
|
|
5
5
|
|
|
6
6
|
# @param [WebSocket::Client::Simple] ws
|
|
7
7
|
# @return [Thread]
|
|
8
|
-
def stream_stdin_to_ws(ws)
|
|
8
|
+
def stream_stdin_to_ws(ws, tty: nil)
|
|
9
9
|
require 'io/console'
|
|
10
10
|
Thread.new {
|
|
11
|
-
if
|
|
11
|
+
if tty
|
|
12
12
|
STDIN.raw {
|
|
13
13
|
while char = STDIN.readpartial(1024)
|
|
14
14
|
ws.text(JSON.dump({ stdin: char }))
|
|
@@ -7,6 +7,8 @@ describe Kontena::Cli::Nodes::ListCommand do
|
|
|
7
7
|
let(:subject) { described_class.new("kontena") }
|
|
8
8
|
|
|
9
9
|
before do
|
|
10
|
+
Kontena.pastel.resolver.color.disable!
|
|
11
|
+
|
|
10
12
|
allow(subject).to receive(:health_icon) {|health| health.inspect }
|
|
11
13
|
allow(subject).to receive(:client).and_return(client)
|
|
12
14
|
end
|
|
@@ -133,7 +135,7 @@ describe Kontena::Cli::Nodes::ListCommand do
|
|
|
133
135
|
{
|
|
134
136
|
"connected" => false,
|
|
135
137
|
"name" => nil,
|
|
136
|
-
"node_number" =>
|
|
138
|
+
"node_number" => 3,
|
|
137
139
|
"initial_member" => false,
|
|
138
140
|
'agent_version' => nil,
|
|
139
141
|
},
|
|
@@ -146,7 +148,7 @@ describe Kontena::Cli::Nodes::ListCommand do
|
|
|
146
148
|
expect{subject.run([])}.to output_table [
|
|
147
149
|
[':warning node-1', '1.1-dev', 'online', '1 / 3', '-'],
|
|
148
150
|
[':warning node-2', '1.1-dev', 'online', '2 / 3', '-'],
|
|
149
|
-
[':offline (initializing)', '
|
|
151
|
+
[':offline (initializing)', 'offline', '-', '-'], # missing agent_version
|
|
150
152
|
]
|
|
151
153
|
end
|
|
152
154
|
end
|
|
@@ -5,6 +5,10 @@ require 'kontena/cli/common'
|
|
|
5
5
|
describe Kontena::Cli::TableGenerator do
|
|
6
6
|
let(:data) { [{'a' => 'a1', 'b' => 'b1', 'c' => 'c1'}, {'a' => 'a2', 'b' => 'b2', 'c' => 'c2'}] }
|
|
7
7
|
|
|
8
|
+
before do
|
|
9
|
+
Kontena.pastel.resolver.color.disable!
|
|
10
|
+
end
|
|
11
|
+
|
|
8
12
|
context Kontena::Cli::TableGenerator::Helper do
|
|
9
13
|
let(:klass) { Class.new(Kontena::Command) }
|
|
10
14
|
|
|
@@ -32,11 +32,13 @@ module OutputHelpers
|
|
|
32
32
|
supports_block_expectations
|
|
33
33
|
|
|
34
34
|
match do |block|
|
|
35
|
+
@errors = []
|
|
36
|
+
|
|
35
37
|
@expected = lines
|
|
36
38
|
begin
|
|
37
39
|
@real = CaptureStdoutLines.capture(block)
|
|
38
40
|
rescue Exception => error
|
|
39
|
-
@
|
|
41
|
+
@errors = [error.to_s]
|
|
40
42
|
return false
|
|
41
43
|
end
|
|
42
44
|
|
|
@@ -52,23 +54,27 @@ module OutputHelpers
|
|
|
52
54
|
line = 0
|
|
53
55
|
@real.zip(@expected) do |real, expected|
|
|
54
56
|
line += 1
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
fields = real.split(/\s{2,}/)
|
|
58
|
+
unless values_match?(fields, expected)
|
|
59
|
+
@errors << [
|
|
60
|
+
"on line #{line}:",
|
|
61
|
+
" expected: #{expected}",
|
|
62
|
+
" received: #{fields}",
|
|
63
|
+
].join("\n")
|
|
60
64
|
end
|
|
61
65
|
end
|
|
62
66
|
else
|
|
63
|
-
@
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
@errors << [
|
|
68
|
+
"expected #{@expected.size} lines but got #{@real.size} lines instead:",
|
|
69
|
+
" Expected:", @expected.map{|l| l.inspect},
|
|
70
|
+
" Received:", @real.map{|l| l.split(/\s{2,}/).inspect},
|
|
71
|
+
].join("\n")
|
|
66
72
|
end
|
|
67
|
-
@
|
|
73
|
+
@errors.empty?
|
|
68
74
|
end
|
|
69
75
|
|
|
70
76
|
failure_message do |block|
|
|
71
|
-
@
|
|
77
|
+
@errors.join "\n"
|
|
72
78
|
end
|
|
73
79
|
|
|
74
80
|
chain :with_header do |header|
|
|
@@ -78,10 +84,6 @@ module OutputHelpers
|
|
|
78
84
|
chain :without_header do
|
|
79
85
|
@no_header = true
|
|
80
86
|
end
|
|
81
|
-
|
|
82
|
-
failure_message do |block|
|
|
83
|
-
return @error
|
|
84
|
-
end
|
|
85
87
|
end
|
|
86
88
|
|
|
87
89
|
matcher :output_lines do |lines|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kontena-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.2.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kontena, Inc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-06-
|
|
11
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -682,9 +682,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
682
682
|
version: 2.1.0
|
|
683
683
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
684
684
|
requirements:
|
|
685
|
-
- - "
|
|
685
|
+
- - ">"
|
|
686
686
|
- !ruby/object:Gem::Version
|
|
687
|
-
version:
|
|
687
|
+
version: 1.3.1
|
|
688
688
|
requirements: []
|
|
689
689
|
rubyforge_project:
|
|
690
690
|
rubygems_version: 2.6.8
|