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 +4 -4
- data/VERSION +1 -1
- data/lib/kontena/cli/services/list_command.rb +6 -1
- data/lib/kontena/cli/services/logs_command.rb +1 -1
- data/lib/kontena/cli/services/monitor_command.rb +2 -2
- data/lib/kontena/cli/services/services_helper.rb +1 -1
- data/lib/kontena/cli/services/stats_command.rb +1 -1
- data/spec/kontena/cli/services/link_command_spec.rb +1 -1
- data/spec/kontena/cli/services/secrets/link_command_spec.rb +4 -4
- data/spec/kontena/cli/services/secrets/unlink_command_spec.rb +2 -2
- data/spec/kontena/cli/services/services_helper_spec.rb +8 -8
- data/spec/kontena/cli/services/unlink_command_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cd10a782d72e14c697891b6de5aa825f6d25ee3
|
4
|
+
data.tar.gz: 4a00e35a86fed8fa9f41dd194a81577e921a26d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73c71530dac6cd22b3781754cd6302cca76e4b3421edf58ea7e929d2dff00e077a507b80e81bd759e8abdc9625faf5247c724852ad9bf17074afc7634678a1c0
|
7
|
+
data.tar.gz: 68493feaf35cbb9e0c0a2611d1ca52b7f7ed4aafde767565d73e799e873c05f9ff83a5b99c50279696b6f3ba604a76899d6485effb595b3e9221332816447c3c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.17.0.
|
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
|
-
|
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/#{
|
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/#{
|
19
|
-
result = client(token).get("services/#{
|
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
|
@@ -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/#{
|
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/
|
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/
|
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/
|
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/
|
58
|
-
expect(client).to receive(:put).with("services/test-grid/
|
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/
|
45
|
-
expect(client).to receive(:put).with("services/test-grid/
|
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/
|
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/
|
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/
|
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/
|
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/
|
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/
|
68
|
-
expect(client).to receive(:post).with('services/test-grid/
|
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/
|
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/
|
38
|
+
'services/test-grid/null/service-a', {links: []}
|
39
39
|
)
|
40
40
|
subject.run(['service-a', 'service-b'])
|
41
41
|
end
|