automan 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/automan.gemspec +3 -3
- data/lib/automan/version.rb +1 -1
- data/spec/beanstalk/application_spec.rb +17 -17
- data/spec/beanstalk/configuration_spec.rb +24 -24
- data/spec/beanstalk/deployer_spec.rb +65 -65
- data/spec/beanstalk/router_spec.rb +18 -18
- data/spec/beanstalk/terminator_spec.rb +16 -16
- data/spec/beanstalk/uploader_spec.rb +13 -13
- data/spec/beanstalk/version_spec.rb +8 -9
- data/spec/cloudformation/launcher_spec.rb +63 -65
- data/spec/cloudformation/replacer_spec.rb +10 -10
- data/spec/cloudformation/terminator_spec.rb +23 -23
- data/spec/cloudformation/uploader_spec.rb +13 -13
- data/spec/ec2/image_spec.rb +55 -55
- data/spec/ec2/instance_spec.rb +17 -17
- data/spec/mixins/aws_caller_spec.rb +9 -9
- data/spec/mixins/utils_spec.rb +27 -28
- data/spec/rds/snapshot_spec.rb +43 -45
- data/templates/stacker/.ruby-version +1 -0
- data/templates/stacker/bin/{launch_%app_name%.sh → launch_%app_name%.sh.tt} +2 -2
- metadata +12 -10
- data/.rvmrc +0 -1
data/spec/mixins/utils_spec.rb
CHANGED
@@ -1,44 +1,43 @@
|
|
1
1
|
require 'automan/mixins/utils'
|
2
2
|
|
3
3
|
describe Automan::Mixins::Utils do
|
4
|
-
|
4
|
+
subject() { (Class.new { include Automan::Mixins::Utils }).new }
|
5
5
|
|
6
6
|
it "adds String#underscore" do
|
7
|
-
|
8
|
-
s.should respond_to :underscore
|
7
|
+
expect(String.new).to respond_to :underscore
|
9
8
|
end
|
10
9
|
|
11
10
|
describe "String#underscore" do
|
12
11
|
it "underscore's like a boss" do
|
13
|
-
"Namespace".underscore.
|
14
|
-
"OptionName".underscore.
|
15
|
-
"Value".underscore.
|
12
|
+
expect("Namespace".underscore).to eq "namespace"
|
13
|
+
expect("OptionName".underscore).to eq "option_name"
|
14
|
+
expect("Value".underscore).to eq "value"
|
16
15
|
end
|
17
16
|
end
|
18
17
|
|
19
|
-
it {
|
18
|
+
it { is_expected.to respond_to :region_from_az }
|
20
19
|
|
21
20
|
it "returns az properly" do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
21
|
+
expect(subject.region_from_az("us-east-1a")).to eq 'us-east-1'
|
22
|
+
expect(subject.region_from_az("us-east-1b")).to eq 'us-east-1'
|
23
|
+
expect(subject.region_from_az("us-east-1c")).to eq 'us-east-1'
|
24
|
+
expect(subject.region_from_az("us-east-1d")).to eq 'us-east-1'
|
25
|
+
expect(subject.region_from_az("ap-northeast-1a")).to eq 'ap-northeast-1'
|
26
|
+
expect(subject.region_from_az("ap-northeast-1b")).to eq 'ap-northeast-1'
|
27
|
+
expect(subject.region_from_az("ap-northeast-1c")).to eq 'ap-northeast-1'
|
28
|
+
expect(subject.region_from_az("sa-east-1a")).to eq 'sa-east-1'
|
29
|
+
expect(subject.region_from_az("sa-east-1b")).to eq 'sa-east-1'
|
30
|
+
expect(subject.region_from_az("ap-southeast-1a")).to eq 'ap-southeast-1'
|
31
|
+
expect(subject.region_from_az("ap-southeast-1b")).to eq 'ap-southeast-1'
|
32
|
+
expect(subject.region_from_az("ap-southeast-2a")).to eq 'ap-southeast-2'
|
33
|
+
expect(subject.region_from_az("ap-southeast-2b")).to eq 'ap-southeast-2'
|
34
|
+
expect(subject.region_from_az("us-west-2a")).to eq 'us-west-2'
|
35
|
+
expect(subject.region_from_az("us-west-2b")).to eq 'us-west-2'
|
36
|
+
expect(subject.region_from_az("us-west-2c")).to eq 'us-west-2'
|
37
|
+
expect(subject.region_from_az("us-west-1a")).to eq 'us-west-1'
|
38
|
+
expect(subject.region_from_az("us-west-1c")).to eq 'us-west-1'
|
39
|
+
expect(subject.region_from_az("eu-west-1a")).to eq 'eu-west-1'
|
40
|
+
expect(subject.region_from_az("eu-west-1b")).to eq 'eu-west-1'
|
41
|
+
expect(subject.region_from_az("eu-west-1c")).to eq 'eu-west-1'
|
43
42
|
end
|
44
43
|
end
|
data/spec/rds/snapshot_spec.rb
CHANGED
@@ -4,35 +4,35 @@ require 'logger'
|
|
4
4
|
ENV['MAX_SNAPSHOTS'] = "50"
|
5
5
|
|
6
6
|
describe Automan::RDS::Snapshot do
|
7
|
-
it {
|
8
|
-
it {
|
9
|
-
it {
|
10
|
-
it {
|
11
|
-
it {
|
12
|
-
it {
|
7
|
+
it { is_expected.to respond_to :rds }
|
8
|
+
it { is_expected.to respond_to :create }
|
9
|
+
it { is_expected.to respond_to :delete }
|
10
|
+
it { is_expected.to respond_to :prune }
|
11
|
+
it { is_expected.to respond_to :latest }
|
12
|
+
it { is_expected.to respond_to :default_snapshot_name }
|
13
13
|
|
14
14
|
describe '#default_snapshot_name' do
|
15
|
-
subject(
|
15
|
+
subject() do
|
16
16
|
AWS.stub!
|
17
17
|
s = Automan::RDS::Snapshot.new
|
18
18
|
s.logger = Logger.new('/dev/null')
|
19
|
-
s.
|
19
|
+
allow(s).to receive(:db_environment).and_return('dev1')
|
20
20
|
s
|
21
21
|
end
|
22
22
|
|
23
23
|
it "never returns nil" do
|
24
|
-
|
24
|
+
expect(subject.default_snapshot_name('somedb')).to_not be_nil
|
25
25
|
end
|
26
26
|
|
27
27
|
it "returns environment dash time string" do
|
28
|
-
name =
|
29
|
-
name.
|
28
|
+
name = subject.default_snapshot_name('somedb')
|
29
|
+
expect(name).to match /^dev1-(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})/
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
33
33
|
|
34
34
|
describe '#create' do
|
35
|
-
subject(
|
35
|
+
subject() do
|
36
36
|
AWS.stub!
|
37
37
|
s = Automan::RDS::Snapshot.new
|
38
38
|
s.logger = Logger.new('/dev/null')
|
@@ -40,56 +40,56 @@ describe Automan::RDS::Snapshot do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "raises error if could not find database" do
|
43
|
-
|
43
|
+
allow(subject).to receive(:find_db).and_return(nil)
|
44
44
|
expect {
|
45
|
-
|
45
|
+
subject.create
|
46
46
|
}.to raise_error Automan::RDS::DatabaseDoesNotExistError
|
47
47
|
end
|
48
48
|
|
49
49
|
it "raises error if RDS says database does not exist" do
|
50
50
|
db = double(:db)
|
51
|
-
db.
|
52
|
-
|
51
|
+
allow(db).to receive(:exists?).and_return(false)
|
52
|
+
allow(subject).to receive(:find_db).and_return(db)
|
53
53
|
|
54
54
|
expect {
|
55
|
-
|
55
|
+
subject.create
|
56
56
|
}.to raise_error Automan::RDS::DatabaseDoesNotExistError
|
57
57
|
end
|
58
58
|
|
59
59
|
end
|
60
60
|
|
61
61
|
describe '#tagged_can_prune?' do
|
62
|
-
subject(
|
62
|
+
subject() do
|
63
63
|
AWS.stub!
|
64
64
|
s = Automan::RDS::Snapshot.new
|
65
65
|
s.logger = Logger.new('/dev/null')
|
66
|
-
s.
|
66
|
+
allow(s).to receive(:snapshot_arn)
|
67
67
|
s
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'returns true if snapshot is tagged with CanPrune=yes' do
|
71
|
-
|
72
|
-
|
71
|
+
allow(subject).to receive(:tags).and_return( {'CanPrune' => 'yes'} )
|
72
|
+
expect(subject.tagged_can_prune?( double() )).to be_truthy
|
73
73
|
end
|
74
74
|
|
75
75
|
it 'returns false if snapshot is missing CanPrune tag' do
|
76
|
-
|
77
|
-
|
76
|
+
allow(subject).to receive(:tags).and_return( {} )
|
77
|
+
expect(subject.tagged_can_prune?( double() )).to be_falsey
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'returns false if snapshot is tagged with CanPrune=nil' do
|
81
|
-
|
82
|
-
|
81
|
+
allow(subject).to receive(:tags).and_return( {'CanPrune' => nil} )
|
82
|
+
expect(subject.tagged_can_prune?( double() )).to be_falsey
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'returns false if snapshot is tagged with CanPrune=foo' do
|
86
|
-
|
87
|
-
|
86
|
+
allow(subject).to receive(:tags).and_return( {'CanPrune' => 'foo'} )
|
87
|
+
expect(subject.tagged_can_prune?( double() )).to be_falsey
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
91
|
describe '#available?' do
|
92
|
-
subject(
|
92
|
+
subject() do
|
93
93
|
AWS.stub!
|
94
94
|
s = Automan::RDS::Snapshot.new
|
95
95
|
s.logger = Logger.new('/dev/null')
|
@@ -97,21 +97,19 @@ describe Automan::RDS::Snapshot do
|
|
97
97
|
end
|
98
98
|
|
99
99
|
it 'returns true if status is "available"' do
|
100
|
-
snap = double(:
|
101
|
-
|
102
|
-
s.available?(snap).should be_true
|
100
|
+
snap = double(status: 'available')
|
101
|
+
expect(subject.available?(snap)).to be_truthy
|
103
102
|
end
|
104
103
|
|
105
104
|
it 'returns false if status is foo' do
|
106
|
-
snap = double(:
|
107
|
-
|
108
|
-
s.available?(snap).should be_false
|
105
|
+
snap = double(status: 'foo')
|
106
|
+
expect(subject.available?(snap)).to be_falsey
|
109
107
|
end
|
110
108
|
end
|
111
109
|
|
112
110
|
describe '#manual?' do
|
113
111
|
let(:snap) { double }
|
114
|
-
subject(
|
112
|
+
subject() do
|
115
113
|
AWS.stub!
|
116
114
|
s = Automan::RDS::Snapshot.new
|
117
115
|
s.logger = Logger.new('/dev/null')
|
@@ -119,34 +117,34 @@ describe Automan::RDS::Snapshot do
|
|
119
117
|
end
|
120
118
|
|
121
119
|
it 'returns true if type is "manual"' do
|
122
|
-
snap.
|
123
|
-
|
120
|
+
allow(snap).to receive(:snapshot_type).and_return('manual')
|
121
|
+
expect(subject.manual?(snap)).to be_truthy
|
124
122
|
end
|
125
123
|
|
126
124
|
it 'returns false if type is foo' do
|
127
|
-
snap.
|
128
|
-
|
125
|
+
allow(snap).to receive(:snapshot_type).and_return('foo')
|
126
|
+
expect(subject.manual?(snap)).to be_falsey
|
129
127
|
end
|
130
128
|
end
|
131
129
|
|
132
130
|
describe '#prunable_snapshots' do
|
133
131
|
let(:snap) { double }
|
134
|
-
subject(
|
132
|
+
subject() do
|
135
133
|
AWS.stub!
|
136
134
|
s = Automan::RDS::Snapshot.new
|
137
135
|
s.logger = Logger.new('/dev/null')
|
138
|
-
s.
|
136
|
+
allow(s).to receive(:get_all_snapshots).and_return( [ snap ] )
|
139
137
|
s
|
140
138
|
end
|
141
139
|
|
142
140
|
it 'includes snapshots which can be pruned' do
|
143
|
-
|
144
|
-
|
141
|
+
allow(subject).to receive(:can_prune?).and_return(true)
|
142
|
+
expect(subject.prunable_snapshots).to include(snap)
|
145
143
|
end
|
146
144
|
|
147
145
|
it 'excludes snapshots which should not be pruned' do
|
148
|
-
|
149
|
-
|
146
|
+
allow(subject).to receive(:can_prune?).and_return(false)
|
147
|
+
expect(subject.prunable_snapshots).to_not include(snap)
|
150
148
|
end
|
151
149
|
end
|
152
150
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
2.2.2
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# To set template parameters, add the -p options
|
3
3
|
# to the end of the stacker command:
|
4
4
|
#
|
5
|
-
# stacker launch -n <%= app_name %> -t <%= app_name %>.json --disable-rollback \
|
5
|
+
# stacker launch -n <%= @app_name %> -t <%= @app_name %>.json --disable-rollback \
|
6
6
|
# -p VpcId:$VPC_ID \
|
7
7
|
# SubnetId:$SUBNET_ID \
|
8
8
|
# RemoteAccessSG:$REMOTE_ACCESS_SG \
|
9
9
|
# KeyPairName:$KEYPAIR_NAME \
|
10
10
|
# InstanceType:$INSTANCE_TYPE \
|
11
11
|
# ImageId:$IMAGE_ID
|
12
|
-
stacker launch -n <%= app_name %> -t <%= app_name %>.json --disable-rollback
|
12
|
+
stacker launch -n <%= @app_name %> -t <%= @app_name %>.json --disable-rollback
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: automan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Chalfant
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -45,42 +45,42 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: '3'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: '3'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec-mocks
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
62
|
+
version: '3'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: '3'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rspec-expectations
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: '3'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: '3'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: aws-sdk
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,7 +166,8 @@ extensions: []
|
|
166
166
|
extra_rdoc_files: []
|
167
167
|
files:
|
168
168
|
- ".gitignore"
|
169
|
-
- ".
|
169
|
+
- ".ruby-gemset"
|
170
|
+
- ".ruby-version"
|
170
171
|
- ".travis.yml"
|
171
172
|
- Gemfile
|
172
173
|
- LICENSE.txt
|
@@ -236,9 +237,10 @@ files:
|
|
236
237
|
- templates/stacker/.env.example
|
237
238
|
- templates/stacker/.gitignore
|
238
239
|
- templates/stacker/.ruby-gemset.tt
|
240
|
+
- templates/stacker/.ruby-version
|
239
241
|
- templates/stacker/Gemfile
|
240
242
|
- templates/stacker/bin/%app_name%.tt
|
241
|
-
- templates/stacker/bin/launch_%app_name%.sh
|
243
|
+
- templates/stacker/bin/launch_%app_name%.sh.tt
|
242
244
|
homepage: ''
|
243
245
|
licenses: []
|
244
246
|
metadata: {}
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm --create use ruby-2.1.2@automan
|