opsworks-cli 0.4.1 → 0.4.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6ab71b0b796bf206ce8f8be50e4275267af4651
|
4
|
+
data.tar.gz: 898cced859136b9f9fdd39e824180e51f764542e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a3b3e7276dacecf8929a4bfd2fd25dc557e8c6dd29ce2e04629dd7aefcc1cac51a679d4b865be05ce2d5c49bdac7e45ee599de6a808d5b69ee66af1dc309f2a
|
7
|
+
data.tar.gz: 81dd251f0a67ecf4643151cc30743e2f374d426a98917c4966ac095312a49cc31351df0651ea15854f062752cc6623bd4626e8fdaf704ad7e2642d9637710ae2
|
@@ -12,13 +12,14 @@ module OpsWorks
|
|
12
12
|
desc 'apps:deploy APP [--stack STACK]', 'Deploy an OpsWorks app'
|
13
13
|
option :stack, type: :array
|
14
14
|
option :timeout, type: :numeric, default: 300
|
15
|
+
option :migrate, type: :boolean, default: false
|
15
16
|
define_method 'apps:deploy' do |name|
|
16
17
|
fetch_credentials unless env_credentials?
|
17
18
|
stacks = parse_stacks(options.merge(active: true))
|
18
19
|
deployments = stacks.map do |stack|
|
19
20
|
next unless (app = stack.find_app_by_name(name))
|
20
21
|
say "Deploying to #{stack.name}..."
|
21
|
-
stack.deploy_app(app)
|
22
|
+
stack.deploy_app(app, 'migrate' => [options[:migrate].to_s])
|
22
23
|
end
|
23
24
|
deployments.compact!
|
24
25
|
OpsWorks::Deployment.wait(deployments, options[:timeout])
|
data/lib/opsworks/cli/version.rb
CHANGED
data/lib/opsworks/stack.rb
CHANGED
@@ -99,9 +99,15 @@ module OpsWorks
|
|
99
99
|
)
|
100
100
|
end
|
101
101
|
|
102
|
-
def deploy_app(app)
|
102
|
+
def deploy_app(app, args = {})
|
103
103
|
fail 'App not found' unless app && app.id
|
104
|
-
create_deployment(
|
104
|
+
create_deployment(
|
105
|
+
app_id: app.id,
|
106
|
+
command: {
|
107
|
+
name: 'deploy',
|
108
|
+
args: args
|
109
|
+
}
|
110
|
+
)
|
105
111
|
end
|
106
112
|
|
107
113
|
def active?
|
@@ -20,34 +20,50 @@ describe OpsWorks::CLI::Agent do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should update custom cookbooks on all stacks' do
|
23
|
-
expect(stacks[0]).to receive(:deploy_app)
|
24
|
-
|
23
|
+
expect(stacks[0]).to receive(:deploy_app)
|
24
|
+
.with(app, anything) { success }
|
25
|
+
expect(stacks[1]).to receive(:deploy_app)
|
26
|
+
.with(app, anything) { success }
|
25
27
|
subject.send('apps:deploy', app_name)
|
26
28
|
end
|
27
29
|
|
28
30
|
it 'should not fail if some stacks are inactive' do
|
29
31
|
allow(OpsWorks::Stack).to receive(:active) { [stacks[0]] }
|
30
|
-
expect(stacks[0]).to receive(:deploy_app)
|
32
|
+
expect(stacks[0]).to receive(:deploy_app)
|
33
|
+
.with(app, anything) { success }
|
31
34
|
expect(stacks[1]).not_to receive(:deploy_app)
|
32
35
|
subject.send('apps:deploy', app_name)
|
33
36
|
end
|
34
37
|
|
35
38
|
it 'should optionally run on a subset of stacks' do
|
36
|
-
expect(stacks[0]).to receive(:deploy_app)
|
39
|
+
expect(stacks[0]).to receive(:deploy_app)
|
40
|
+
.with(app, anything) { success }
|
37
41
|
expect(stacks[1]).not_to receive(:deploy_app)
|
38
42
|
|
39
43
|
allow(subject).to receive(:options) { { stack: [stacks[0].name] } }
|
40
44
|
subject.send('apps:deploy', app_name)
|
41
45
|
end
|
42
46
|
|
47
|
+
it 'should optionally run migrations' do
|
48
|
+
expect(stacks[0]).to receive(:deploy_app)
|
49
|
+
.with(app, 'migrate' => ['true']) { success }
|
50
|
+
expect(stacks[1]).to receive(:deploy_app)
|
51
|
+
.with(app, 'migrate' => ['true']) { success }
|
52
|
+
|
53
|
+
allow(subject).to receive(:options) { { migrate: true } }
|
54
|
+
subject.send('apps:deploy', app_name)
|
55
|
+
end
|
56
|
+
|
43
57
|
it 'should not fail if a stack does not have the app' do
|
44
58
|
allow(stacks[0]).to receive(:apps) { [] }
|
45
|
-
expect(stacks[1]).to receive(:deploy_app)
|
59
|
+
expect(stacks[1]).to receive(:deploy_app)
|
60
|
+
.with(app, anything) { success }
|
46
61
|
expect { subject.send('apps:deploy', app_name) }.not_to raise_error
|
47
62
|
end
|
48
63
|
|
49
64
|
it 'should fail if any update fails' do
|
50
|
-
expect(stacks[0]).to receive(:deploy_app)
|
65
|
+
expect(stacks[0]).to receive(:deploy_app)
|
66
|
+
.with(app, anything) { failure }
|
51
67
|
|
52
68
|
allow(subject).to receive(:options) { { stack: [stacks[0].name] } }
|
53
69
|
expect { subject.send('apps:deploy', app_name) }.to raise_error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opsworks-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|