kontena-cli 1.0.1.rc1 → 1.0.1.rc2
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/stacks/common.rb +2 -2
- data/lib/kontena/cli/stacks/install_command.rb +1 -1
- data/lib/kontena/cli/stacks/upgrade_command.rb +1 -1
- data/spec/kontena/cli/stacks/install_command_spec.rb +1 -1
- data/spec/kontena/cli/stacks/upgrade_command_spec.rb +8 -8
- 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: fdcf34433ba7835fede5369afbbc9559c6492924
|
4
|
+
data.tar.gz: 7d3a2b29b763a1341d72a8ada76584d909073e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60ab49c26084f991a866e0c2ef3082f9e22295544c65d2cda645e6cb87cd4a1ec42db4d03a7de2e05516fee07aa507fbbc07d418c069931f519a4b0e4eadbe4a
|
7
|
+
data.tar.gz: f03d5fed14586662fca3db267152e052db4d92ce7a607c2a08ca80377a0be9b98a1d4cf769adfa876628aee95ff7c012ceae5fb298d3b260dab46e3ae365f0b5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.1.
|
1
|
+
1.0.1.rc2
|
@@ -24,12 +24,12 @@ module Kontena::Cli::Stacks
|
|
24
24
|
@stack_name ||= self.name || stack_name_from_yaml(filename)
|
25
25
|
end
|
26
26
|
|
27
|
-
def stack_from_yaml(filename, from_registry: false)
|
27
|
+
def stack_from_yaml(filename, from_registry: false, name: nil)
|
28
28
|
reader = Kontena::Cli::Stacks::YAML::Reader.new(filename, from_registry: from_registry)
|
29
29
|
if reader.stack_name.nil?
|
30
30
|
exit_with_error "Stack MUST have stack name in YAML top level field 'stack'! Aborting."
|
31
31
|
end
|
32
|
-
set_env_variables(reader.stack_name, current_grid)
|
32
|
+
set_env_variables(name || reader.stack_name, current_grid)
|
33
33
|
outcome = reader.execute
|
34
34
|
|
35
35
|
hint_on_validation_notifications(outcome[:notifications]) if outcome[:notifications].size > 0
|
@@ -25,7 +25,7 @@ module Kontena::Cli::Stacks
|
|
25
25
|
require_config_file(filename)
|
26
26
|
end
|
27
27
|
|
28
|
-
stack = stack_from_yaml(filename, from_registry: from_registry)
|
28
|
+
stack = stack_from_yaml(filename, from_registry: from_registry, name: name)
|
29
29
|
stack['name'] = name if name
|
30
30
|
spinner "Creating stack #{pastel.cyan(stack['name'])} " do
|
31
31
|
create_stack(stack)
|
@@ -59,7 +59,7 @@ describe Kontena::Cli::Stacks::InstallCommand do
|
|
59
59
|
|
60
60
|
it 'accepts a stack name as filename' do
|
61
61
|
expect(File).to receive(:exist?).with('user/stack:1.0.0').and_return(false)
|
62
|
-
expect(subject).to receive(:stack_from_yaml).with('user/stack:1.0.0', from_registry: true).and_return(stack)
|
62
|
+
expect(subject).to receive(:stack_from_yaml).with('user/stack:1.0.0', from_registry: true, name: nil).and_return(stack)
|
63
63
|
expect(client).to receive(:post).with(
|
64
64
|
'grids/test-grid/stacks', stack
|
65
65
|
)
|
@@ -16,33 +16,33 @@ describe Kontena::Cli::Stacks::UpgradeCommand do
|
|
16
16
|
|
17
17
|
it 'requires api url' do
|
18
18
|
allow(subject).to receive(:require_config_file).and_return(true)
|
19
|
-
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml').and_return(stack)
|
19
|
+
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-name').and_return(stack)
|
20
20
|
expect(described_class.requires_current_master?).to be_truthy
|
21
21
|
subject.run(['stack-name', './path/to/kontena.yml'])
|
22
22
|
end
|
23
23
|
|
24
24
|
it 'requires token' do
|
25
25
|
allow(subject).to receive(:require_config_file).and_return(true)
|
26
|
-
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml').and_return(stack)
|
26
|
+
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-name').and_return(stack)
|
27
27
|
expect(described_class.requires_current_master_token?).to be_truthy
|
28
28
|
subject.run(['stack-name', './path/to/kontena.yml'])
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'requires stack file' do
|
32
|
-
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml').and_return(stack)
|
32
|
+
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-name').and_return(stack)
|
33
33
|
expect(subject).to receive(:require_config_file).with('./path/to/kontena.yml').and_return(true)
|
34
34
|
subject.run(['stack-name', './path/to/kontena.yml'])
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'uses kontena.yml as default stack file' do
|
38
38
|
expect(subject).to receive(:require_config_file).with('kontena.yml').and_return(true)
|
39
|
-
expect(subject).to receive(:stack_from_yaml).with('kontena.yml').and_return(stack)
|
39
|
+
expect(subject).to receive(:stack_from_yaml).with('kontena.yml', name: 'stack-name').and_return(stack)
|
40
40
|
subject.run(['stack-name'])
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'sends stack to master' do
|
44
44
|
allow(subject).to receive(:require_config_file).with('./path/to/kontena.yml').and_return(true)
|
45
|
-
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml').and_return(stack)
|
45
|
+
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-a').and_return(stack)
|
46
46
|
expect(client).to receive(:put).with(
|
47
47
|
'stacks/test-grid/stack-a', anything
|
48
48
|
)
|
@@ -51,7 +51,7 @@ describe Kontena::Cli::Stacks::UpgradeCommand do
|
|
51
51
|
|
52
52
|
it 'allows to override stack name' do
|
53
53
|
allow(subject).to receive(:require_config_file).with('./path/to/kontena.yml').and_return(true)
|
54
|
-
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml').and_return(stack)
|
54
|
+
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-b').and_return(stack)
|
55
55
|
stack_b = stack
|
56
56
|
stack_b[:name] = 'stack-b'
|
57
57
|
expect(client).to receive(:put).with(
|
@@ -64,7 +64,7 @@ describe Kontena::Cli::Stacks::UpgradeCommand do
|
|
64
64
|
context 'when given' do
|
65
65
|
it 'triggers deploy' do
|
66
66
|
allow(subject).to receive(:require_config_file).with('./path/to/kontena.yml').and_return(true)
|
67
|
-
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml').and_return(stack)
|
67
|
+
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-a').and_return(stack)
|
68
68
|
allow(client).to receive(:put).with(
|
69
69
|
'stacks/test-grid/stack-a', anything
|
70
70
|
).and_return({})
|
@@ -75,7 +75,7 @@ describe Kontena::Cli::Stacks::UpgradeCommand do
|
|
75
75
|
context 'when not given' do
|
76
76
|
it 'does not trigger deploy' do
|
77
77
|
allow(subject).to receive(:require_config_file).with('./path/to/kontena.yml').and_return(true)
|
78
|
-
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml').and_return(stack)
|
78
|
+
allow(subject).to receive(:stack_from_yaml).with('./path/to/kontena.yml', name: 'stack-a').and_return(stack)
|
79
79
|
allow(client).to receive(:put).with(
|
80
80
|
'stacks/test-grid/stack-a', anything
|
81
81
|
).and_return({})
|