kontena-cli 1.4.0.pre5 → 1.4.0.pre6

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: 9521c63986952c3d6e770bf225fe6a30400eb2d6
4
- data.tar.gz: f1a7355bcf1c4597cca0a213dccb1b20dbe63eb2
3
+ metadata.gz: 750f17967025517060b46f32a63528d34aa6c578
4
+ data.tar.gz: bd34c1c6c26e981984e15ce74cf0a03f9e96425e
5
5
  SHA512:
6
- metadata.gz: facae60dda263da930a28095b812fdd2093fb4fe833b83a95b992f77708c775f28cb6d527577817020a37fe7e966cf4a9535faf39fa6ffa700101692a819a4fa
7
- data.tar.gz: 4e61b9b417159744787827cd0ecac452bf2803977ba588bfe270ea89fa02cd02d8f797e131b890bc09e0b9f38f5e0bb164c5213736e5762bee06fa82c58b433f
6
+ metadata.gz: 7e3574f15562be1bb53e0fa6c8c0f7db14a7925760174b9d794d411c976cbe08f49aa0f80d0a106de24c8b9495110811b4e611bc4d6ad521009b5a0f71a74fc3
7
+ data.tar.gz: 77e86e97a2691c16e210589d3d60ef41dfcd07087f9743b215a03628a65f2b804f9390e815fa2d179d9d74be3596ab8dec732d842d8a49694941996b3280696e
data/Dockerfile CHANGED
@@ -7,9 +7,12 @@ ARG CLI_VERSION
7
7
  RUN apk update && \
8
8
  apk --update add ruby ruby-json ruby-bigdecimal ruby-io-console \
9
9
  ca-certificates libssl1.0 openssl libstdc++ && \
10
- gem install kontena-cli --no-rdoc --no-ri -v ${CLI_VERSION} && \
11
10
  chmod +x /usr/local/bin/docker
12
11
 
12
+ RUN apk --update add --virtual build-dependencies ruby-dev build-base openssl-dev && \
13
+ gem install kontena-cli --no-rdoc --no-ri -v ${CLI_VERSION} && \
14
+ apk del build-dependencies
15
+
13
16
  VOLUME ["/root"]
14
17
  WORKDIR /root
15
18
  ENTRYPOINT ["/usr/bin/kontena"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.4.0.pre5
1
+ 1.4.0.pre6
@@ -14,10 +14,15 @@ module Kontena::Cli::Nodes
14
14
  grid_uri = self.current_master['url'].sub('http', 'ws')
15
15
  end
16
16
 
17
- def execute
18
- token_node = client.get("nodes/#{current_grid}/#{name}/token")
17
+ def get_node_token
18
+ return client.get("nodes/#{current_grid}/#{name}/token")
19
+ rescue Kontena::Errors::StandardError => exc
20
+ raise unless exc.status == 404
21
+ return nil
22
+ end
19
23
 
20
- unless token_node['token']
24
+ def execute
25
+ unless token_node = get_node_token()
21
26
  exit_with_error "Node #{name} was not created with a node token. Use `kontena grid env` instead"
22
27
  end
23
28
 
@@ -17,14 +17,17 @@ module Kontena::Cli::Nodes
17
17
  def execute
18
18
  confirm("Resetting the node token will disconnect the agent (unless using --no-reset-connection), and require you to reconfigure the kontena-agent using the new `kontena node env` values before it will be able to reconnect. Are you sure?")
19
19
 
20
- data = {}
21
-
22
- data[:token] = self.token
23
- data[:token] = '' if self.clear_token?
24
- data[:reset_connection] = self.reset_connection?
25
-
26
20
  spinner "Resetting node #{self.node.colorize(:cyan)} websocket connection token" do
27
- client.put("nodes/#{current_grid}/#{self.node}/token", data)
21
+ if self.clear_token?
22
+ client.delete("nodes/#{current_grid}/#{self.node}/token",
23
+ reset_connection: self.reset_connection?,
24
+ )
25
+ else
26
+ client.put("nodes/#{current_grid}/#{self.node}/token",
27
+ token: self.token,
28
+ reset_connection: self.reset_connection?,
29
+ )
30
+ end
28
31
  end
29
32
  end
30
33
  end
@@ -31,15 +31,8 @@ describe Kontena::Cli::Nodes::EnvCommand do
31
31
  end
32
32
 
33
33
  context 'for a node without any token' do
34
- let :node_token do
35
- {
36
- "id" => nil,
37
- "token" => nil,
38
- }
39
- end
40
-
41
34
  before do
42
- expect(client).to receive(:get).with('nodes/test-grid/node-1/token').and_return(node_token)
35
+ expect(client).to receive(:get).with('nodes/test-grid/node-1/token').and_raise(Kontena::Errors::StandardError.new(404, "Host node does not have a node token"))
43
36
  end
44
37
 
45
38
  it 'uses the grid token' do
@@ -30,9 +30,15 @@ describe Kontena::Cli::Nodes::ResetTokenCommand do
30
30
  subject.run(['--force', '--no-reset-connection', 'test-node'])
31
31
  end
32
32
 
33
- it 'PUTs to clear token without reset_connection' do
34
- expect(client).to receive(:put).with('nodes/test-grid/test-node/token', {token: '', reset_connection: false})
33
+ it 'DELETEs to clear token without reset_connection' do
34
+ expect(client).to receive(:delete).with('nodes/test-grid/test-node/token', {reset_connection: false})
35
35
 
36
36
  subject.run(['--force', '--no-reset-connection', '--clear-token', 'test-node'])
37
37
  end
38
+
39
+ it 'DELETEs to clear token with reset_connection' do
40
+ expect(client).to receive(:delete).with('nodes/test-grid/test-node/token', {reset_connection: true})
41
+
42
+ subject.run(['--force', '--clear-token', 'test-node'])
43
+ end
38
44
  end
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.4.0.pre5
4
+ version: 1.4.0.pre6
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-07-28 00:00:00.000000000 Z
11
+ date: 2017-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler