automan 2.3.6 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/Rakefile +5 -0
- data/automan.gemspec +3 -3
- data/lib/automan/base.rb +7 -3
- data/lib/automan/beanstalk/deployer.rb +1 -1
- data/lib/automan/beanstalk/package.rb +1 -1
- data/lib/automan/beanstalk/router.rb +1 -1
- data/lib/automan/cli/snapper.rb +29 -29
- data/lib/automan/cli/stacker.rb +19 -0
- data/lib/automan/cloudformation/launcher.rb +6 -3
- data/lib/automan/cloudformation/replacer.rb +1 -1
- data/lib/automan/cloudformation/terminator.rb +1 -1
- data/lib/automan/ec2/image.rb +3 -3
- data/lib/automan/elasticache/router.rb +79 -0
- data/lib/automan/mixins/aws_caller.rb +21 -7
- data/lib/automan/rds/snapshot.rb +35 -14
- data/lib/automan/s3/downloader.rb +10 -1
- data/lib/automan/version.rb +1 -1
- data/lib/automan.rb +1 -0
- 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 -19
- data/spec/beanstalk/terminator_spec.rb +16 -16
- data/spec/beanstalk/uploader_spec.rb +13 -13
- data/spec/beanstalk/version_spec.rb +8 -10
- 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/elasticache/router_spec.rb +29 -0
- data/spec/mixins/aws_caller_spec.rb +9 -9
- data/spec/mixins/utils_spec.rb +27 -28
- data/spec/rds/snapshot_spec.rb +44 -46
- data/templates/stacker/.env.example +14 -0
- data/templates/stacker/.gitignore +2 -0
- data/templates/stacker/.ruby-gemset.tt +1 -0
- data/templates/stacker/.ruby-version +1 -0
- data/templates/stacker/Gemfile +4 -0
- data/templates/stacker/bin/%app_name%.tt +62 -0
- data/templates/stacker/bin/launch_%app_name%.sh.tt +12 -0
- metadata +20 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfb2258dca674b5f5538a66cf62dfb5b85dba8fa
|
4
|
+
data.tar.gz: 1eae94e8cacea86e1bec2ed10220a59e59d6b898
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 365b6f670a7cffcc09f049132a7d41b123eeca5f0f1d81147dc39122a13566e3e8b0573f7dc20e24f4096a71c7f875d484347e6e2f8f8235091544e6d69bed67
|
7
|
+
data.tar.gz: 7019345e8fbf59862b6dfeb8c7b805df644ed817dffd101fd360f17aab0a949142b3c11faa68b539377bf7dbb43fbeef14c2f09b7eae6df3dc8109a90f0c77b6
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
automan
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.2
|
data/.travis.yml
ADDED
data/Rakefile
CHANGED
data/automan.gemspec
CHANGED
@@ -19,9 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
21
|
spec.add_development_dependency "rake"
|
22
|
-
spec.add_development_dependency "rspec-core", "~>
|
23
|
-
spec.add_development_dependency "rspec-mocks", "~>
|
24
|
-
spec.add_development_dependency "rspec-expectations", "~>
|
22
|
+
spec.add_development_dependency "rspec-core", "~> 3"
|
23
|
+
spec.add_development_dependency "rspec-mocks", "~> 3"
|
24
|
+
spec.add_development_dependency "rspec-expectations", "~> 3"
|
25
25
|
spec.add_dependency "aws-sdk", "< 2.0"
|
26
26
|
spec.add_dependency "thor"
|
27
27
|
spec.add_dependency "json"
|
data/lib/automan/base.rb
CHANGED
@@ -12,11 +12,9 @@ module Automan
|
|
12
12
|
|
13
13
|
include Automan::Mixins::AwsCaller
|
14
14
|
|
15
|
-
def initialize(options=
|
15
|
+
def initialize(options={})
|
16
16
|
$stdout.sync = true
|
17
17
|
@logger = Logger.new(STDOUT)
|
18
|
-
@log_aws_calls = false
|
19
|
-
#@wait = Wait.new(rescuer: WaitRescuer.new, logger: @logger)
|
20
18
|
|
21
19
|
if !options.nil?
|
22
20
|
options.each_pair do |k,v|
|
@@ -24,6 +22,12 @@ module Automan
|
|
24
22
|
send(accessor, v) if respond_to? accessor
|
25
23
|
end
|
26
24
|
end
|
25
|
+
|
26
|
+
aws_options = {}
|
27
|
+
if options[:log_aws]
|
28
|
+
aws_options[:logger] = @logger
|
29
|
+
end
|
30
|
+
configure_aws(aws_options)
|
27
31
|
end
|
28
32
|
|
29
33
|
def self.add_option(*args)
|
@@ -13,7 +13,7 @@ module Automan::Beanstalk
|
|
13
13
|
|
14
14
|
# verify local package exists
|
15
15
|
unless File.exists? source
|
16
|
-
raise
|
16
|
+
raise MissingPackageFileError, "package file #{source} does not exist"
|
17
17
|
end
|
18
18
|
|
19
19
|
logger.info "Uploading #{source} to #{destination}"
|
data/lib/automan/cli/snapper.rb
CHANGED
@@ -7,28 +7,28 @@ module Automan::Cli
|
|
7
7
|
desc "create", "create a snapshot"
|
8
8
|
|
9
9
|
option :environment,
|
10
|
-
|
11
|
-
|
10
|
+
aliases: "-e",
|
11
|
+
desc: "environment of database to snapshot"
|
12
12
|
|
13
13
|
option :database,
|
14
|
-
|
15
|
-
|
14
|
+
aliases: "-d",
|
15
|
+
desc: "name of the database to snapshot"
|
16
16
|
|
17
17
|
option :name,
|
18
|
-
|
19
|
-
|
18
|
+
aliases: "-n",
|
19
|
+
desc: "what to name the snapshot"
|
20
20
|
|
21
21
|
option :prune,
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
aliases: "-p",
|
23
|
+
type: :boolean,
|
24
|
+
default: true,
|
25
|
+
desc: "make this snapshot prunable and delete other prunable snapshots older than 30 days"
|
26
26
|
|
27
27
|
option :wait_for_completion,
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
aliases: "-w",
|
29
|
+
type: :boolean,
|
30
|
+
default: false,
|
31
|
+
desc: "wait until snapshot is finished before exiting script"
|
32
32
|
|
33
33
|
def create
|
34
34
|
if options[:database].nil? && options[:environment].nil?
|
@@ -37,8 +37,9 @@ module Automan::Cli
|
|
37
37
|
exit 1
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
aws_opts = options.dup
|
41
|
+
aws_opts[:log_aws] = true
|
42
|
+
s = Automan::RDS::Snapshot.new(aws_opts)
|
42
43
|
s.prune_snapshots if options[:prune]
|
43
44
|
s.create
|
44
45
|
end
|
@@ -46,9 +47,9 @@ module Automan::Cli
|
|
46
47
|
desc "delete", "delete a snapshot"
|
47
48
|
|
48
49
|
option :name,
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
required: true,
|
51
|
+
aliases: "-n",
|
52
|
+
desc: "name of snapshot to delete"
|
52
53
|
|
53
54
|
def delete
|
54
55
|
Automan::RDS::Snapshot.new(options).delete
|
@@ -57,12 +58,12 @@ module Automan::Cli
|
|
57
58
|
desc "latest", "find the most recent snapshot"
|
58
59
|
|
59
60
|
option :database,
|
60
|
-
|
61
|
-
|
61
|
+
aliases: "-d",
|
62
|
+
desc: "name of the database to snapshot"
|
62
63
|
|
63
64
|
option :environment,
|
64
|
-
|
65
|
-
|
65
|
+
aliases: "-e",
|
66
|
+
desc: "environment of database to snapshot"
|
66
67
|
|
67
68
|
def latest
|
68
69
|
if options[:database].nil? && options[:environment].nil?
|
@@ -77,15 +78,14 @@ module Automan::Cli
|
|
77
78
|
desc "count", "return the number of snapshots"
|
78
79
|
|
79
80
|
option :environment,
|
80
|
-
|
81
|
-
|
81
|
+
aliases: "-e",
|
82
|
+
desc: "environment of database to snapshot"
|
82
83
|
|
83
84
|
option :database,
|
84
|
-
|
85
|
-
|
85
|
+
aliases: "-d",
|
86
|
+
desc: "name of the database to snapshot"
|
86
87
|
|
87
88
|
def count
|
88
|
-
|
89
89
|
if options[:database].nil? && options[:environment].nil?
|
90
90
|
puts "Must specify either database or environment"
|
91
91
|
help "count"
|
@@ -94,6 +94,6 @@ module Automan::Cli
|
|
94
94
|
|
95
95
|
Automan::RDS::Snapshot.new(options).count_snapshots
|
96
96
|
end
|
97
|
-
|
97
|
+
|
98
98
|
end
|
99
99
|
end
|
data/lib/automan/cli/stacker.rb
CHANGED
@@ -102,5 +102,24 @@ module Automan::Cli
|
|
102
102
|
h = Automan::Cloudformation::Launcher.new(options).parse_template_parameters
|
103
103
|
say JSON.pretty_generate h
|
104
104
|
end
|
105
|
+
|
106
|
+
include Thor::Actions
|
107
|
+
def self.source_root
|
108
|
+
File.join(File.dirname(__FILE__),'..','..', '..')
|
109
|
+
end
|
110
|
+
|
111
|
+
desc "project APP_NAME", "create stacker project"
|
112
|
+
|
113
|
+
attr_reader :app_name
|
114
|
+
|
115
|
+
def project(app_name)
|
116
|
+
@app_name = app_name
|
117
|
+
|
118
|
+
say "\nCreating stacker project: #{app_name}\n", :yellow
|
119
|
+
directory 'templates/stacker', app_name
|
120
|
+
[app_name, "launch_#{app_name}.sh"].each do |file|
|
121
|
+
chmod File.join(app_name, 'bin', file), 0755
|
122
|
+
end
|
123
|
+
end
|
105
124
|
end
|
106
125
|
end
|
@@ -16,7 +16,7 @@ module Automan::Cloudformation
|
|
16
16
|
|
17
17
|
include Automan::Mixins::Utils
|
18
18
|
|
19
|
-
def initialize(options=
|
19
|
+
def initialize(options={})
|
20
20
|
@wait_for_completion = false
|
21
21
|
super
|
22
22
|
@wait = Wait.new({
|
@@ -148,6 +148,8 @@ module Automan::Cloudformation
|
|
148
148
|
|
149
149
|
logger.info "updating stack #{name}"
|
150
150
|
|
151
|
+
no_updates_needed = false
|
152
|
+
|
151
153
|
# if cfn determines that no updates are to be performed,
|
152
154
|
# it raises a ValidationError
|
153
155
|
begin
|
@@ -157,10 +159,11 @@ module Automan::Cloudformation
|
|
157
159
|
raise e
|
158
160
|
else
|
159
161
|
logger.info e.message
|
162
|
+
no_updates_needed = true
|
160
163
|
end
|
161
164
|
end
|
162
165
|
|
163
|
-
if wait_for_completion
|
166
|
+
if !no_updates_needed && wait_for_completion
|
164
167
|
logger.info "waiting for stack #{name} to update"
|
165
168
|
wait_until { stack_update_complete? }
|
166
169
|
end
|
@@ -193,4 +196,4 @@ module Automan::Cloudformation
|
|
193
196
|
end
|
194
197
|
end
|
195
198
|
|
196
|
-
end
|
199
|
+
end
|
data/lib/automan/ec2/image.rb
CHANGED
@@ -7,7 +7,7 @@ module Automan::Ec2
|
|
7
7
|
|
8
8
|
include Automan::Mixins::Utils
|
9
9
|
|
10
|
-
def initialize(options=
|
10
|
+
def initialize(options={})
|
11
11
|
super
|
12
12
|
@wait = Wait.new({
|
13
13
|
delay: 5,
|
@@ -45,7 +45,7 @@ module Automan::Ec2
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def default_image_name
|
48
|
-
stime = Time.
|
48
|
+
stime = Time.now.utc.iso8601.gsub(/[:+]/, '')
|
49
49
|
return name + "-" + stime
|
50
50
|
end
|
51
51
|
|
@@ -134,4 +134,4 @@ module Automan::Ec2
|
|
134
134
|
end
|
135
135
|
|
136
136
|
end
|
137
|
-
end
|
137
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'automan'
|
2
|
+
|
3
|
+
module Automan::ElastiCache
|
4
|
+
class Router < Automan::Base
|
5
|
+
|
6
|
+
add_option :environment,
|
7
|
+
:hosted_zone_name,
|
8
|
+
:redis_host
|
9
|
+
|
10
|
+
def node_name_from_elasticache_environment(env)
|
11
|
+
|
12
|
+
opts = {
|
13
|
+
cache_cluster_id: "redis-#{env}",
|
14
|
+
show_cache_node_info: true
|
15
|
+
}
|
16
|
+
|
17
|
+
response = ec.client.describe_cache_clusters opts
|
18
|
+
|
19
|
+
unless response.successful?
|
20
|
+
raise RequestFailedError, "describe_cache_clusters failed: #{response.error}"
|
21
|
+
end
|
22
|
+
|
23
|
+
cluster=response.data[:cache_clusters]
|
24
|
+
if cluster.empty?
|
25
|
+
return nil
|
26
|
+
end
|
27
|
+
|
28
|
+
nodes=Hash[*cluster][:cache_nodes]
|
29
|
+
if nodes.empty?
|
30
|
+
return nil
|
31
|
+
end
|
32
|
+
|
33
|
+
endpoint=Hash[*nodes][:endpoint]
|
34
|
+
if endpoint.empty?
|
35
|
+
return nil
|
36
|
+
end
|
37
|
+
|
38
|
+
logger.info "found redis endpoint at #{endpoint[:address]}"
|
39
|
+
endpoint[:address]
|
40
|
+
end
|
41
|
+
|
42
|
+
# be sure alias_name ends in period
|
43
|
+
def update_dns_alias(zone_name, redis_cname, primary_endpoint)
|
44
|
+
zone = r53.hosted_zones.select {|z| z.name == zone_name}.first
|
45
|
+
rrset = zone.rrsets[redis_cname + '.', 'CNAME']
|
46
|
+
|
47
|
+
if rrset.exists?
|
48
|
+
logger.info "removing old record at #{redis_cname}"
|
49
|
+
rrset.delete
|
50
|
+
end
|
51
|
+
|
52
|
+
logger.info "creating record #{redis_cname} -> #{primary_endpoint}"
|
53
|
+
zone.rrsets.create(
|
54
|
+
redis_cname + '.',
|
55
|
+
'CNAME',
|
56
|
+
:ttl => 300,
|
57
|
+
:resource_records => [{:value => primary_endpoint}]
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def run
|
62
|
+
log_options
|
63
|
+
|
64
|
+
logger.info "getting redis primary node name..."
|
65
|
+
primary_endpoint = node_name_from_elasticache_environment environment
|
66
|
+
|
67
|
+
if primary_endpoint.nil?
|
68
|
+
false
|
69
|
+
else
|
70
|
+
update_dns_alias(
|
71
|
+
hosted_zone_name,
|
72
|
+
redis_host,
|
73
|
+
primary_endpoint
|
74
|
+
)
|
75
|
+
true
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -8,14 +8,20 @@ module Automan
|
|
8
8
|
ENV['AWS_ACCOUNT_ID']
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
AWS.
|
11
|
+
def configure_aws(options={})
|
12
|
+
if ENV['AWS_ROLE']
|
13
|
+
sts = AWS::STS.new
|
14
|
+
|
15
|
+
@logger.info "Assuming role #{ENV['AWS_ROLE']}"
|
16
|
+
provider = AWS::Core::CredentialProviders::AssumeRoleProvider.new(
|
17
|
+
sts: sts,
|
18
|
+
role_arn: ENV['AWS_ROLE'],
|
19
|
+
role_session_name: "automan-aws-sdk"
|
20
|
+
)
|
21
|
+
options[:credential_provider] = provider
|
17
22
|
end
|
18
|
-
|
23
|
+
|
24
|
+
AWS.config(options)
|
19
25
|
end
|
20
26
|
|
21
27
|
attr_writer :eb
|
@@ -102,6 +108,14 @@ module Automan
|
|
102
108
|
@rds
|
103
109
|
end
|
104
110
|
|
111
|
+
attr_writer :ec
|
112
|
+
def ec
|
113
|
+
if @ec.nil?
|
114
|
+
@ec = AWS::ElastiCache.new
|
115
|
+
end
|
116
|
+
@ec
|
117
|
+
end
|
118
|
+
|
105
119
|
attr_writer :ec2
|
106
120
|
def ec2
|
107
121
|
if @ec2.nil?
|
data/lib/automan/rds/snapshot.rb
CHANGED
@@ -12,7 +12,7 @@ module Automan::RDS
|
|
12
12
|
|
13
13
|
attr_accessor :max_snapshots
|
14
14
|
|
15
|
-
def initialize(options=
|
15
|
+
def initialize(options={})
|
16
16
|
@prune = true
|
17
17
|
@wait_for_completion = false
|
18
18
|
super
|
@@ -33,6 +33,8 @@ module Automan::RDS
|
|
33
33
|
|
34
34
|
include Automan::Mixins::Utils
|
35
35
|
|
36
|
+
# TODO move this and dependecies to an RDS utils class
|
37
|
+
# so we can re-use it
|
36
38
|
def find_db
|
37
39
|
db = nil
|
38
40
|
if !database.nil?
|
@@ -63,7 +65,9 @@ module Automan::RDS
|
|
63
65
|
end
|
64
66
|
|
65
67
|
def snapshot_count
|
66
|
-
|
68
|
+
AWS.memoize do
|
69
|
+
rds.db_instances[find_db.id].snapshots.count
|
70
|
+
end
|
67
71
|
end
|
68
72
|
|
69
73
|
def create
|
@@ -93,8 +97,8 @@ module Automan::RDS
|
|
93
97
|
snap = db.create_snapshot(myname)
|
94
98
|
|
95
99
|
if prune == true
|
96
|
-
logger.info "Setting snapshot to be prunable"
|
97
|
-
|
100
|
+
logger.info "Setting snapshot to be prunable and tagging environment"
|
101
|
+
set_prunable_and_env(snap,environment)
|
98
102
|
end
|
99
103
|
|
100
104
|
if wait_for_completion == true
|
@@ -120,7 +124,7 @@ module Automan::RDS
|
|
120
124
|
|
121
125
|
def default_snapshot_name(db)
|
122
126
|
env = db_environment db
|
123
|
-
stime = Time.new.
|
127
|
+
stime = Time.new.strftime("%Y-%m-%dT%H-%M")
|
124
128
|
|
125
129
|
return env + "-" + stime
|
126
130
|
end
|
@@ -145,10 +149,10 @@ module Automan::RDS
|
|
145
149
|
end
|
146
150
|
|
147
151
|
# tag with CanPrune
|
148
|
-
def
|
152
|
+
def set_prunable_and_env(snapshot,environment)
|
149
153
|
opts = {
|
150
154
|
resource_name: snapshot_arn(snapshot),
|
151
|
-
tags: [ {key: 'CanPrune', value: 'yes'} ]
|
155
|
+
tags: [ {key: 'CanPrune', value: 'yes'}, {key: 'Environment', value: environment} ]
|
152
156
|
}
|
153
157
|
response = rds.client.add_tags_to_resource opts
|
154
158
|
|
@@ -185,6 +189,15 @@ module Automan::RDS
|
|
185
189
|
tagged_can_prune?(snapshot) && available?(snapshot) && manual?(snapshot)
|
186
190
|
end
|
187
191
|
|
192
|
+
def is_env?(snapshot,environment)
|
193
|
+
tagged_env?(snapshot,environment) && available?(snapshot) && manual?(snapshot)
|
194
|
+
end
|
195
|
+
|
196
|
+
def tagged_env?(snapshot,environment)
|
197
|
+
arn = snapshot_arn(snapshot)
|
198
|
+
tags(arn)['Environment'] == environment
|
199
|
+
end
|
200
|
+
|
188
201
|
def tagged_can_prune?(snapshot)
|
189
202
|
arn = snapshot_arn(snapshot)
|
190
203
|
tags(arn)['CanPrune'] == 'yes'
|
@@ -208,10 +221,8 @@ module Automan::RDS
|
|
208
221
|
end
|
209
222
|
|
210
223
|
def prunable_snapshots
|
211
|
-
|
212
|
-
|
213
|
-
snapshots.select { |s| can_prune?(s) }
|
214
|
-
end
|
224
|
+
snapshots = get_all_snapshots
|
225
|
+
snapshots.select { |s| can_prune?(s) }
|
215
226
|
end
|
216
227
|
|
217
228
|
def oldest_prunable_snapshot
|
@@ -248,10 +259,20 @@ module Automan::RDS
|
|
248
259
|
|
249
260
|
def latest
|
250
261
|
log_options
|
251
|
-
|
252
|
-
|
253
|
-
|
262
|
+
logger.info "Finding most recent snapshot for #{environment}"
|
263
|
+
|
264
|
+
allsnaps=get_all_snapshots
|
265
|
+
|
266
|
+
envsnaps=[]
|
267
|
+
allsnaps.each do |onesnap|
|
268
|
+
if is_env?(onesnap,environment)
|
269
|
+
envsnaps.push(onesnap)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
s=envsnaps.sort_by {|i| i.created_at }.last
|
254
274
|
logger.info "Most recent snapshot is #{s.id}"
|
275
|
+
s.id
|
255
276
|
end
|
256
277
|
end
|
257
278
|
end
|
@@ -9,7 +9,7 @@ module Automan::S3
|
|
9
9
|
def download
|
10
10
|
log_options
|
11
11
|
|
12
|
-
logger.info "
|
12
|
+
logger.info "downloading #{s3file} to #{localfile}"
|
13
13
|
|
14
14
|
bucket, key = parse_s3_path s3file
|
15
15
|
|
@@ -18,7 +18,16 @@ module Automan::S3
|
|
18
18
|
file.write(chunk)
|
19
19
|
end
|
20
20
|
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def read
|
24
|
+
log_options
|
25
|
+
|
26
|
+
logger.info "returning contents of #{s3file} as string"
|
27
|
+
|
28
|
+
bucket, key = parse_s3_path s3file
|
21
29
|
|
30
|
+
s3.buckets[bucket].objects[key].read
|
22
31
|
end
|
23
32
|
|
24
33
|
end
|
data/lib/automan/version.rb
CHANGED
data/lib/automan.rb
CHANGED
@@ -19,6 +19,7 @@ require 'automan/cloudformation/terminator'
|
|
19
19
|
require 'automan/cloudformation/replacer'
|
20
20
|
require 'automan/cloudformation/uploader'
|
21
21
|
require 'automan/cloudformation/errors'
|
22
|
+
require 'automan/elasticache/router'
|
22
23
|
require 'automan/rds/snapshot'
|
23
24
|
require 'automan/rds/errors'
|
24
25
|
require 'automan/ec2/instance'
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require "automan"
|
2
2
|
|
3
3
|
describe Automan::Beanstalk::Application do
|
4
|
-
it {
|
5
|
-
it {
|
6
|
-
it {
|
4
|
+
it { is_expected.to respond_to :name }
|
5
|
+
it { is_expected.to respond_to :create }
|
6
|
+
it { is_expected.to respond_to :delete }
|
7
7
|
|
8
8
|
describe '#create' do
|
9
|
-
subject(
|
9
|
+
subject() do
|
10
10
|
AWS.stub!
|
11
11
|
a = Automan::Beanstalk::Application.new
|
12
12
|
a.logger = Logger.new('/dev/null')
|
@@ -14,20 +14,20 @@ describe Automan::Beanstalk::Application do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "does not create if the application already exists" do
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
allow(subject).to receive(:application_exists?).and_return(true)
|
18
|
+
expect(subject).to_not receive(:create_application)
|
19
|
+
subject.create
|
20
20
|
end
|
21
21
|
|
22
22
|
it "does create if the application doesn't exist" do
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
allow(subject).to receive(:application_exists?).and_return(false)
|
24
|
+
expect(subject).to receive(:create_application)
|
25
|
+
subject.create
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe '#delete' do
|
30
|
-
subject(
|
30
|
+
subject() do
|
31
31
|
AWS.stub!
|
32
32
|
a = Automan::Beanstalk::Application.new
|
33
33
|
a.logger = Logger.new('/dev/null')
|
@@ -35,15 +35,15 @@ describe Automan::Beanstalk::Application do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "does delete if the application already exists" do
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
allow(subject).to receive(:application_exists?).and_return(true)
|
39
|
+
expect(subject).to receive(:delete_application)
|
40
|
+
subject.delete
|
41
41
|
end
|
42
42
|
|
43
43
|
it "does not delete if the application doesn't exist" do
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
allow(subject).to receive(:application_exists?).and_return(false)
|
45
|
+
expect(subject).to_not receive(:delete_application)
|
46
|
+
subject.delete
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|