kontena-cli 0.17.0.pre3 → 0.17.0.pre4

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: 091d78ecbf785c27a358a6df073988d29127d73d
4
- data.tar.gz: e74870ae94379be1bd36a1cd06cbc23a6a56279f
3
+ metadata.gz: 2cd10a782d72e14c697891b6de5aa825f6d25ee3
4
+ data.tar.gz: 4a00e35a86fed8fa9f41dd194a81577e921a26d1
5
5
  SHA512:
6
- metadata.gz: dcef3ab01f20279b7bcfd13430fe069bc5d9763f437ffb77015a59066c1bcc48968554c0f959ce896464525dfbbcbb526227f5e79393ddaebd28bc2fe6af42f8
7
- data.tar.gz: f14436a2b06fab14df0d72fa506067dbda2a3b8e566e1e6040b1563625b95d3fae10472c9a4694122d1bccd2af139fe7ae26fcde188cbf2210d132bffdd4581e
6
+ metadata.gz: 73c71530dac6cd22b3781754cd6302cca76e4b3421edf58ea7e929d2dff00e077a507b80e81bd759e8abdc9625faf5247c724852ad9bf17074afc7634678a1c0
7
+ data.tar.gz: 68493feaf35cbb9e0c0a2611d1ca52b7f7ed4aafde767565d73e799e873c05f9ff83a5b99c50279696b6f3ba604a76899d6485effb595b3e9221332816447c3c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.0.pre3
1
+ 0.17.0.pre4
@@ -37,9 +37,14 @@ module Kontena::Cli::Services
37
37
  "#{p['ip']}:#{p['node_port']}->#{p['container_port']}/#{p['protocol']}"
38
38
  }.join(", ")
39
39
  health = health_status(service)
40
+ if service.dig('stack', 'name').to_s == 'null'.freeze
41
+ name = service['name']
42
+ else
43
+ name = "#{service.dig('stack', 'name')}/#{service['name']}"
44
+ end
40
45
  vars = [
41
46
  health_status_icon(health),
42
- "#{service.dig('stack', 'name')}/#{service['name']}",
47
+ name,
43
48
  instances,
44
49
  stateful,
45
50
  service['state'],
@@ -17,7 +17,7 @@ module Kontena::Cli::Services
17
17
  query_params = {}
18
18
  query_params[:container] = "#{name}-#{instance}" if instance
19
19
 
20
- show_logs("services/#{current_grid}/#{name}/container_logs", query_params) do |log|
20
+ show_logs("services/#{parse_service_id(name)}/container_logs", query_params) do |log|
21
21
  show_log(log)
22
22
  end
23
23
  end
@@ -15,8 +15,8 @@ module Kontena::Cli::Services
15
15
 
16
16
  loop do
17
17
  nodes = {}
18
- service = client(token).get("services/#{current_grid}/#{name}")
19
- result = client(token).get("services/#{current_grid}/#{name}/containers")
18
+ service = client(token).get("services/#{parse_service_id(name)}")
19
+ result = client(token).get("services/#{parse_service_id(name)}/containers")
20
20
  result['containers'].each do |container|
21
21
  nodes[container['node']['name']] ||= []
22
22
  nodes[container['node']['name']] << container
@@ -279,7 +279,7 @@ module Kontena
279
279
  elsif count == 1
280
280
  param = "#{current_grid}/#{service_id}"
281
281
  else
282
- param = "#{current_grid}/default/#{service_id}"
282
+ param = "#{current_grid}/null/#{service_id}"
283
283
  end
284
284
  end
285
285
 
@@ -30,7 +30,7 @@ module Kontena::Cli::Services
30
30
  private
31
31
 
32
32
  def fetch_stats(token, service_id, follow)
33
- result = client(token).get("services/#{current_grid}/#{service_id}/stats")
33
+ result = client(token).get("services/#{parse_service_id(service_id)}/stats")
34
34
  system('clear') if follow
35
35
  render_header
36
36
  result['stats'].each do |stat|
@@ -35,7 +35,7 @@ describe Kontena::Cli::Services::LinkCommand do
35
35
 
36
36
  it 'sends link to master' do
37
37
  expect(client).to receive(:put).with(
38
- 'services/test-grid/default/service-a', {links: [{name: 'service-b', alias: 'service-b'}]}
38
+ 'services/test-grid/null/service-a', {links: [{name: 'service-b', alias: 'service-b'}]}
39
39
  )
40
40
  subject.run(['service-a', 'service-b'])
41
41
  end
@@ -35,10 +35,10 @@ describe Kontena::Cli::Services::Secrets::LinkCommand do
35
35
  {secret: 'MY_PASSWORD', name: 'PASSWORD', type: 'env'}
36
36
  ]
37
37
  }
38
- allow(client).to receive(:get).with("services/test-grid/default/foo").and_return({
38
+ allow(client).to receive(:get).with("services/test-grid/null/foo").and_return({
39
39
  'secrets' => []
40
40
  })
41
- expect(client).to receive(:put).with("services/test-grid/default/foo", data)
41
+ expect(client).to receive(:put).with("services/test-grid/null/foo", data)
42
42
  subject.run(['foo', 'MY_PASSWORD:PASSWORD:env'])
43
43
  end
44
44
 
@@ -54,8 +54,8 @@ describe Kontena::Cli::Services::Secrets::LinkCommand do
54
54
  {secret: 'MY_PASSWORD', name: 'PASSWORD', type: 'env'}
55
55
  ]
56
56
  }
57
- allow(client).to receive(:get).with("services/test-grid/default/foo").and_return(original)
58
- expect(client).to receive(:put).with("services/test-grid/default/foo", data)
57
+ allow(client).to receive(:get).with("services/test-grid/null/foo").and_return(original)
58
+ expect(client).to receive(:put).with("services/test-grid/null/foo", data)
59
59
  subject.run(['foo', 'MY_PASSWORD:PASSWORD:env'])
60
60
  end
61
61
  end
@@ -41,8 +41,8 @@ describe Kontena::Cli::Services::Secrets::UnlinkCommand do
41
41
  {'secret' => 'BAR', 'name' => 'BAZ', 'type' => 'env'}
42
42
  ]
43
43
  }
44
- allow(client).to receive(:get).with("services/test-grid/default/mymy").and_return(original)
45
- expect(client).to receive(:put).with("services/test-grid/default/mymy", data)
44
+ allow(client).to receive(:get).with("services/test-grid/null/mymy").and_return(original)
45
+ expect(client).to receive(:put).with("services/test-grid/null/mymy", data)
46
46
  subject.run(['mymy', 'FOO:BAR:env'])
47
47
  end
48
48
  end
@@ -29,43 +29,43 @@ module Kontena::Cli::Services
29
29
 
30
30
  describe '#update_service' do
31
31
  it 'creates PUT services/:id request to Kontena Server' do
32
- expect(client).to receive(:put).with('services/test-grid/default/1', {'name' => 'test-service'})
32
+ expect(client).to receive(:put).with('services/test-grid/null/1', {'name' => 'test-service'})
33
33
  subject.update_service(token, '1', {'name' => 'test-service'})
34
34
  end
35
35
  end
36
36
 
37
37
  describe '#get_service' do
38
38
  it 'creates GET services/:id request to Kontena Server' do
39
- expect(client).to receive(:get).with('services/test-grid/default/test-service')
39
+ expect(client).to receive(:get).with('services/test-grid/null/test-service')
40
40
  subject.get_service(token, 'test-service')
41
41
  end
42
42
  end
43
43
 
44
44
  describe '#stop_service' do
45
45
  it 'creates POST services/:id/stop request to Kontena Server' do
46
- expect(client).to receive(:post).with('services/test-grid/default/test-service/stop', {})
46
+ expect(client).to receive(:post).with('services/test-grid/null/test-service/stop', {})
47
47
  subject.stop_service(token, 'test-service')
48
48
  end
49
49
  end
50
50
 
51
51
  describe '#start_service' do
52
52
  it 'creates POST services/:id/start request to Kontena Server' do
53
- expect(client).to receive(:post).with('services/test-grid/default/test-service/start', {})
53
+ expect(client).to receive(:post).with('services/test-grid/null/test-service/start', {})
54
54
  subject.start_service(token, 'test-service')
55
55
  end
56
56
  end
57
57
 
58
58
  describe '#restart_service' do
59
59
  it 'creates POST services/:id/restart request to Kontena Server' do
60
- expect(client).to receive(:post).with('services/test-grid/default/test-service/restart', {})
60
+ expect(client).to receive(:post).with('services/test-grid/null/test-service/restart', {})
61
61
  subject.restart_service(token, 'test-service')
62
62
  end
63
63
  end
64
64
 
65
65
  describe '#deploy_service' do
66
66
  it 'creates POST services/:id/deploy request to Kontena Server' do
67
- allow(client).to receive(:get).with('services/test-grid/default/1').and_return({'state' => 'running'})
68
- expect(client).to receive(:post).with('services/test-grid/default/1/deploy', {'strategy' => 'ha'})
67
+ allow(client).to receive(:get).with('services/test-grid/null/1').and_return({'state' => 'running'})
68
+ expect(client).to receive(:post).with('services/test-grid/null/1/deploy', {'strategy' => 'ha'})
69
69
  subject.deploy_service(token, '1', {'strategy' => 'ha'})
70
70
  end
71
71
  end
@@ -147,7 +147,7 @@ module Kontena::Cli::Services
147
147
 
148
148
  describe '#parse_service_id' do
149
149
  it 'adds current_grid & stack if service_id is missing prefix' do
150
- expect(subject.parse_service_id('mysql')).to eq('test-grid/default/mysql')
150
+ expect(subject.parse_service_id('mysql')).to eq('test-grid/null/mysql')
151
151
  end
152
152
 
153
153
  it 'adds current grid if service_id has stack & service' do
@@ -35,7 +35,7 @@ describe Kontena::Cli::Services::UnlinkCommand do
35
35
 
36
36
  it 'sends link to master' do
37
37
  expect(client).to receive(:put).with(
38
- 'services/test-grid/default/service-a', {links: []}
38
+ 'services/test-grid/null/service-a', {links: []}
39
39
  )
40
40
  subject.run(['service-a', 'service-b'])
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kontena-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0.pre3
4
+ version: 0.17.0.pre4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kontena, Inc