cody 0.1.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cody/buildspec.yml +8 -0
- data/.cody/project.rb +4 -0
- data/.cody/settings.yml +13 -0
- data/.gitignore +17 -10
- data/.gitmodules +9 -0
- data/.rspec +1 -1
- data/.ruby-version +1 -0
- data/CHANGELOG.md +59 -0
- data/Gemfile +3 -1
- data/Guardfile +19 -0
- data/LICENSE.txt +18 -17
- data/README.md +145 -18
- data/Rakefile +9 -2
- data/cody.gemspec +26 -12
- data/exe/cody +14 -0
- data/img/github-admin-settings-tab.png +0 -0
- data/lib/cody.rb +17 -1
- data/lib/cody/autoloader.rb +21 -0
- data/lib/cody/aws_services.rb +16 -0
- data/lib/cody/aws_services/helpers.rb +72 -0
- data/lib/cody/cli.rb +61 -0
- data/lib/cody/command.rb +82 -0
- data/lib/cody/completer.rb +159 -0
- data/lib/cody/completer/script.rb +6 -0
- data/lib/cody/completer/script.sh +10 -0
- data/lib/cody/core.rb +63 -0
- data/lib/cody/create.rb +12 -0
- data/lib/cody/default/settings.yml +3 -0
- data/lib/cody/delete.rb +27 -0
- data/lib/cody/deploy.rb +40 -0
- data/lib/cody/dsl/project.rb +119 -0
- data/lib/cody/dsl/project/ssm.rb +22 -0
- data/lib/cody/dsl/role.rb +50 -0
- data/lib/cody/dsl/schedule.rb +30 -0
- data/lib/cody/evaluate.rb +47 -0
- data/lib/cody/help.rb +9 -0
- data/lib/cody/help/completion.md +22 -0
- data/lib/cody/help/completion_script.md +3 -0
- data/lib/cody/help/deploy.md +32 -0
- data/lib/cody/help/init.md +71 -0
- data/lib/cody/help/start.md +12 -0
- data/lib/cody/init.rb +102 -0
- data/lib/cody/project.rb +72 -0
- data/lib/cody/role.rb +87 -0
- data/lib/cody/schedule.rb +102 -0
- data/lib/cody/sequence.rb +66 -0
- data/lib/cody/setting.rb +82 -0
- data/lib/cody/stack.rb +93 -0
- data/lib/cody/start.rb +69 -0
- data/lib/cody/update.rb +12 -0
- data/lib/cody/variables.rb +17 -0
- data/lib/cody/version.rb +2 -2
- data/lib/template/project/buildspec.yml +28 -0
- data/lib/template/project/project.rb.tt +29 -0
- data/lib/template/project/role.rb +2 -0
- data/lib/template/project/schedule.rb +3 -0
- data/lib/template/top/README.md +32 -0
- data/lib/template/top/settings.yml +9 -0
- data/lib/template/top/variables/base.rb +1 -0
- data/lib/template/top/variables/development.rb +1 -0
- data/lib/template/top/variables/production.rb +1 -0
- data/vendor/aws_data/CHANGELOG.md +7 -0
- data/vendor/aws_data/Gemfile +4 -0
- data/vendor/aws_data/LICENSE.txt +21 -0
- data/vendor/aws_data/README.md +42 -0
- data/vendor/aws_data/Rakefile +6 -0
- data/vendor/aws_data/aws_data.gemspec +30 -0
- data/{bin → vendor/aws_data/bin}/console +1 -1
- data/{bin → vendor/aws_data/bin}/setup +0 -0
- data/vendor/aws_data/lib/aws_data.rb +91 -0
- data/vendor/aws_data/lib/aws_data/version.rb +3 -0
- data/vendor/aws_data/spec/aws_data_spec.rb +5 -0
- data/vendor/aws_data/spec/spec_helper.rb +14 -0
- data/vendor/cfn-status/Gemfile +4 -0
- data/vendor/cfn-status/LICENSE.txt +21 -0
- data/vendor/cfn-status/README.md +56 -0
- data/vendor/cfn-status/Rakefile +6 -0
- data/vendor/cfn-status/bin/console +14 -0
- data/vendor/cfn-status/bin/setup +8 -0
- data/vendor/cfn-status/cfn-status.gemspec +30 -0
- data/vendor/cfn-status/lib/cfn/aws_service.rb +56 -0
- data/vendor/cfn-status/lib/cfn/status.rb +220 -0
- data/vendor/cfn-status/lib/cfn/status/version.rb +5 -0
- data/vendor/cfn-status/spec/cfn/status_spec.rb +81 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-complete.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
- data/vendor/cfn-status/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
- data/vendor/cfn-status/spec/spec_helper.rb +14 -0
- data/vendor/cfn_camelizer/CHANGELOG.md +10 -0
- data/vendor/cfn_camelizer/Gemfile +4 -0
- data/vendor/cfn_camelizer/LICENSE.txt +21 -0
- data/vendor/cfn_camelizer/README.md +40 -0
- data/vendor/cfn_camelizer/Rakefile +6 -0
- data/vendor/cfn_camelizer/bin/console +14 -0
- data/vendor/cfn_camelizer/bin/setup +8 -0
- data/vendor/cfn_camelizer/cfn_camelizer.gemspec +32 -0
- data/vendor/cfn_camelizer/lib/camelizer.yml +33 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer.rb +92 -0
- data/vendor/cfn_camelizer/lib/cfn_camelizer/version.rb +3 -0
- data/vendor/cfn_camelizer/spec/cfn_camelizer_spec.rb +79 -0
- data/vendor/cfn_camelizer/spec/spec_helper.rb +14 -0
- metadata +268 -21
- data/.travis.yml +0 -7
@@ -0,0 +1 @@
|
|
1
|
+
@myvar = "base-value"
|
@@ -0,0 +1 @@
|
|
1
|
+
@myvar = "development-value"
|
@@ -0,0 +1 @@
|
|
1
|
+
@myvar = "production-value"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Tung Nguyen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# AwsData
|
2
|
+
|
3
|
+
Simple AWS data library helper. Info like region and account id.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'aws_data'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install aws_data
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require "aws_data"
|
25
|
+
aws = AwsData.new
|
26
|
+
aws.account # account id
|
27
|
+
aws.region # region
|
28
|
+
```
|
29
|
+
|
30
|
+
## Development
|
31
|
+
|
32
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
33
|
+
|
34
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aws_data.
|
39
|
+
|
40
|
+
## License
|
41
|
+
|
42
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,30 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "aws_data/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "aws_data"
|
7
|
+
spec.version = AwsData::VERSION
|
8
|
+
spec.authors = ["Tung Nguyen"]
|
9
|
+
spec.email = ["tongueroo@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "AWS info like region and account id"
|
12
|
+
spec.homepage = "https://github.com/tongueroo/aws_data"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_dependency "memoist"
|
25
|
+
spec.add_dependency "aws-sdk-core" # contains sts service
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
end
|
File without changes
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require "aws_data/version"
|
2
|
+
require "aws-sdk-core"
|
3
|
+
require "aws-sdk-sts"
|
4
|
+
require "memoist"
|
5
|
+
|
6
|
+
class AwsData
|
7
|
+
class Error < StandardError; end
|
8
|
+
extend Memoist
|
9
|
+
|
10
|
+
def region
|
11
|
+
return 'us-east-1' if test?
|
12
|
+
|
13
|
+
return ENV['AWS_REGION'] if ENV['AWS_REGION'] # highest precedence
|
14
|
+
|
15
|
+
region = nil
|
16
|
+
|
17
|
+
# First if aws binary is available
|
18
|
+
# try to get it from the ~/.aws/config
|
19
|
+
if which('aws')
|
20
|
+
region = `aws configure get region 2>&1`.strip rescue nil
|
21
|
+
exit_code = $?.exitstatus
|
22
|
+
if exit_code != 0
|
23
|
+
exception_message = region.split("\n").grep(/botocore\.exceptions/).first
|
24
|
+
if exception_message
|
25
|
+
puts "WARN: #{exception_message}".color(:yellow)
|
26
|
+
else
|
27
|
+
# show full message as warning
|
28
|
+
puts region.color(:yellow)
|
29
|
+
end
|
30
|
+
puts "You can also get rid of this message by setting AWS_REGION or configuring ~/.aws/config with the region"
|
31
|
+
region = nil
|
32
|
+
end
|
33
|
+
region = nil if region == ''
|
34
|
+
return region if region
|
35
|
+
end
|
36
|
+
|
37
|
+
# Second try the metadata endpoint, should be available on AWS Lambda environment
|
38
|
+
# https://stackoverflow.com/questions/4249488/find-region-from-within-an-ec2-instance
|
39
|
+
begin
|
40
|
+
az = `curl -s --max-time 3 --connect-timeout 5 http://169.254.169.254/latest/meta-data/placement/availability-zone`
|
41
|
+
region = az.strip.chop # remove last char
|
42
|
+
region = nil if region == ''
|
43
|
+
rescue
|
44
|
+
end
|
45
|
+
return region if region
|
46
|
+
|
47
|
+
'us-east-1' # default if all else fails
|
48
|
+
end
|
49
|
+
memoize :region
|
50
|
+
|
51
|
+
# aws sts get-caller-identity
|
52
|
+
def account
|
53
|
+
return '123456789' if test?
|
54
|
+
return ENV['AWS_ACCOUNT'] if ENV['AWS_ACCOUNT']
|
55
|
+
|
56
|
+
# ensure region set, required for sts.get_caller_identity.account to work
|
57
|
+
ENV['AWS_REGION'] ||= region
|
58
|
+
begin
|
59
|
+
sts.get_caller_identity.account
|
60
|
+
rescue Aws::Errors::MissingCredentialsError
|
61
|
+
puts "INFO: You're missing AWS credentials. Only local services are currently available"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
memoize :account
|
65
|
+
|
66
|
+
private
|
67
|
+
def test?
|
68
|
+
ENV['TEST']
|
69
|
+
end
|
70
|
+
|
71
|
+
# Cross-platform way of finding an executable in the $PATH.
|
72
|
+
#
|
73
|
+
# which('ruby') #=> /usr/bin/ruby
|
74
|
+
#
|
75
|
+
# source: https://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
76
|
+
def which(cmd)
|
77
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
78
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
79
|
+
exts.each { |ext|
|
80
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
81
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
82
|
+
}
|
83
|
+
end
|
84
|
+
return nil
|
85
|
+
end
|
86
|
+
|
87
|
+
def sts
|
88
|
+
Aws::STS::Client.new
|
89
|
+
end
|
90
|
+
memoize :sts
|
91
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "aws_data"
|
3
|
+
|
4
|
+
RSpec.configure do |config|
|
5
|
+
# Enable flags like --only-failures and --next-failure
|
6
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
7
|
+
|
8
|
+
# Disable RSpec exposing methods globally on `Module` and `main`
|
9
|
+
config.disable_monkey_patching!
|
10
|
+
|
11
|
+
config.expect_with :rspec do |c|
|
12
|
+
c.syntax = :expect
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Tung Nguyen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# Cfn Status
|
2
|
+
|
3
|
+
Helper library provides status of CloudFormation stack.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add this line to your gem's gemspec:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem.add_development_dependency "cfn-status"
|
11
|
+
```
|
12
|
+
|
13
|
+
Require it to your library:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require "cfn/status"
|
17
|
+
```
|
18
|
+
|
19
|
+
Use like so:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
status = Cfn::Status.new(stack_name)
|
23
|
+
status.run # prints out stack events
|
24
|
+
```
|
25
|
+
|
26
|
+
The `status.run` will:
|
27
|
+
|
28
|
+
* print out the most recent stack events and return right away if the stack is in a completed state.
|
29
|
+
* print out the most recent stack events and poll for more events until the stack in a completed state.
|
30
|
+
|
31
|
+
To find out whether the most recent completed state of the stack was a success or a fail, you can use `status.success?`.
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
status.success?
|
35
|
+
```
|
36
|
+
|
37
|
+
If you need to just wait for the stack to complete, you can also use `status.wait`.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
status.wait
|
41
|
+
status.success?
|
42
|
+
```
|
43
|
+
|
44
|
+
## Development
|
45
|
+
|
46
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
47
|
+
|
48
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cfn-status.
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cfn/status"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "cfn/status/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cfn-status"
|
8
|
+
spec.version = Cfn::Status::VERSION
|
9
|
+
spec.authors = ["Tung Nguyen"]
|
10
|
+
spec.email = ["tongueroo@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "CloudFormation status library"
|
13
|
+
spec.homepage = "https://github.com/tongueroo/cfn-status"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
end
|
21
|
+
spec.bindir = "exe"
|
22
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
+
spec.require_paths = ["lib"]
|
24
|
+
|
25
|
+
spec.add_dependency "aws-sdk-cloudformation"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require "aws-sdk-cloudformation"
|
2
|
+
|
3
|
+
module Cfn
|
4
|
+
module AwsService
|
5
|
+
def cfn
|
6
|
+
@cfn ||= Aws::CloudFormation::Client.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def stack_exists?(stack_name)
|
10
|
+
return true if testing_update?
|
11
|
+
return false if @options[:noop]
|
12
|
+
|
13
|
+
exist = nil
|
14
|
+
begin
|
15
|
+
# When the stack does not exist an exception is raised. Example:
|
16
|
+
# Aws::CloudFormation::Errors::ValidationError: Stack with id blah does not exist
|
17
|
+
resp = cfn.describe_stacks(stack_name: stack_name)
|
18
|
+
exist = true
|
19
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
20
|
+
if e.message =~ /does not exist/
|
21
|
+
exist = false
|
22
|
+
elsif e.message.include?("'stackName' failed to satisfy constraint")
|
23
|
+
# Example of e.message when describe_stack with invalid stack name
|
24
|
+
# "1 validation error detected: Value 'instance_and_route53' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*"
|
25
|
+
puts "Invalid stack name: #{stack_name}"
|
26
|
+
puts "Full error message: #{e.message}"
|
27
|
+
exit 1
|
28
|
+
else
|
29
|
+
raise # re-raise exception because unsure what other errors can happen
|
30
|
+
end
|
31
|
+
end
|
32
|
+
exist
|
33
|
+
end
|
34
|
+
|
35
|
+
def find_stack(stack_name)
|
36
|
+
resp = cfn.describe_stacks(stack_name: stack_name)
|
37
|
+
resp.stacks.first
|
38
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
39
|
+
# example: Stack with id demo-web does not exist
|
40
|
+
if e.message =~ /Stack with/ && e.message =~ /does not exist/
|
41
|
+
nil
|
42
|
+
else
|
43
|
+
raise
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def rollback_complete?(stack)
|
48
|
+
stack.stack_status == 'ROLLBACK_COMPLETE'
|
49
|
+
end
|
50
|
+
|
51
|
+
def testing_update?
|
52
|
+
# TODO: Figure out how to get rid of this
|
53
|
+
ENV['TEST'] # && self.class.name == "BoltCfn::Update"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|