aws-cfn-stacker 0.0.1 → 0.0.5
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 +5 -13
- data/aws-cfn-stacker.gemspec +5 -0
- data/aws-cfn-stacker.iml +21 -3
- data/bin/cfn-stacker +25 -0
- data/lib/aws/cfn/stacker/base.rb +10 -0
- data/lib/aws/cfn/stacker/mixins/errors.rb +13 -0
- data/lib/aws/cfn/stacker/mixins/logging.rb +18 -0
- data/lib/aws/cfn/stacker/mixins/main.rb +192 -0
- data/lib/aws/cfn/stacker/mixins/options.rb +495 -0
- data/lib/aws/cfn/stacker/mixins/patches.rb +46 -0
- data/lib/aws/cfn/stacker/mixins/prerequisites.rb +188 -0
- data/lib/aws/cfn/stacker/mixins/setup.rb +58 -0
- data/lib/aws/cfn/stacker/version.rb +6 -1
- data/lib/aws/cfn/stacker.rb +21 -1
- metadata +106 -14
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTlhMTlkMjUxYmU5YTNhMjBiZDc4YjEwODRhNDFhNWMzNWQyYzk0YQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f03ece78cbb17603c8240cc9f1a7cb5e3ac17ac6
|
4
|
+
data.tar.gz: 169c414e261d7e847d8e7b81f49d74f40e48d78e
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
NWIyNzYxNGRlM2ZiMWU1ODIwYjNlNTI3YTZlOTUwMDlhNzY4NTM1MzVkYmE4
|
11
|
-
MWEwZGJjMGJmMDViOTQ1MTc5Y2ZmODIwYzU3Yzk2YzFjZWNhMzE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MDUyZjUzZmM4ZmJlZGVhODdlOWNlNDYxY2U5NjA5YTVjN2NlOWU4YWIzZDZk
|
14
|
-
ZDExOWQ1NzlhZTQzMWQyNjQ2ZDdkOWI2YmMxZGE3YTBhNmZhMzFmYjc2YTQ5
|
15
|
-
YmU2ZDM0ZTgxNTVjMWViN2M5NzQ0YzQ4MTFlODMzZmZiNjA1ZWY=
|
6
|
+
metadata.gz: f6b8db47cf60d1f90675c6398b10ac5f6eec72625feb56825c119f32cd72f3bdf4f8f88570459e7bd2fca188fea9a8a433ad8579ebbb7b937bf655c321721711
|
7
|
+
data.tar.gz: bda408df4f83dafc5148bdb5d755dc297e31500402c1253be6d78ced6d6b824f4bc30e7bd2ead1b498910770780bd4a4246d187c6b96ae9d9156345cd58acdd5
|
data/aws-cfn-stacker.gemspec
CHANGED
@@ -18,6 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
+
spec.add_dependency 'awesome_print'
|
22
|
+
spec.add_dependency 'colorize'
|
23
|
+
spec.add_dependency 'inifile'
|
24
|
+
spec.add_dependency 'dldinternet-mixlib-cli', ">= 0.1.0", '~> 0.1'
|
25
|
+
spec.add_dependency 'dldinternet-mixlib-logging', ">= 0.1.5", '~> 0.1'
|
21
26
|
spec.add_dependency 'aws-cfn-yats', ">= 0.1.6", '~> 0.1'
|
22
27
|
|
23
28
|
spec.add_development_dependency "bundler", "~> 1.6"
|
data/aws-cfn-stacker.iml
CHANGED
@@ -15,10 +15,28 @@
|
|
15
15
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
16
16
|
<exclude-output />
|
17
17
|
<content url="file://$MODULE_DIR$" />
|
18
|
-
<orderEntry type="jdk" jdkName="RVM: ruby-1.9.3-
|
18
|
+
<orderEntry type="jdk" jdkName="RVM: ruby-1.9.3-p547 [aws-cfn-stacker]" jdkType="RUBY_SDK" />
|
19
19
|
<orderEntry type="sourceFolder" forTests="false" />
|
20
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
21
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="awesome_print (v1.2.0, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-cfn-compiler (v0.2.4, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-cfn-decompiler (v0.2.4, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-cfn-dsl (v0.0.4, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="aws-cfn-yats (v0.1.6, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.6.2, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="cloudformation-ruby-dsl (v0.4.3, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="colorize (v0.7.3, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="detabulator (v0.1.0, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="dldinternet-mixlib-cli (v0.1.0, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="dldinternet-mixlib-logging (v0.1.5, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="inifile (v2.0.2, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.1, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="little-plugger (v1.1.3, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="logging (v1.8.2, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="mixlib-cli (v1.5.0, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.10.1, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="psych (v2.0.5, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.3.2, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="slop (v3.5.0, RVM: ruby-1.9.3-p547 [aws-cfn-stacker]) [gem]" level="application" />
|
22
40
|
</component>
|
23
41
|
</module>
|
24
42
|
|
data/bin/cfn-stacker
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
|
5
|
+
# Borrowing from "whiches" gem ...
|
6
|
+
cmd = File.basename(__FILE__)
|
7
|
+
exes = []
|
8
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
9
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
10
|
+
exts.each { |ext|
|
11
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
12
|
+
exes << exe if File.executable? exe
|
13
|
+
}
|
14
|
+
end
|
15
|
+
path = if exes.size > 0
|
16
|
+
File.dirname(exes[0])
|
17
|
+
else
|
18
|
+
File.dirname(__FILE__)
|
19
|
+
end
|
20
|
+
|
21
|
+
add_path = File.expand_path(File.join(path, "..", "lib"))
|
22
|
+
$:.unshift(add_path)
|
23
|
+
|
24
|
+
require 'aws/cfn/stacker'
|
25
|
+
Aws::Cfn::Stacker::Application.new.run(ARGV)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'dldinternet/mixlib/logging'
|
2
|
+
|
3
|
+
module Aws
|
4
|
+
module Cfn
|
5
|
+
module Stacker
|
6
|
+
module Logging
|
7
|
+
include ::DLDInternet::Mixlib::Logging
|
8
|
+
|
9
|
+
def self.included(receiver)
|
10
|
+
|
11
|
+
receiver.extend(::DLDInternet::Mixlib::Logging::ClassMethods)
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
require 'inifile'
|
3
|
+
require 'awesome_print'
|
4
|
+
|
5
|
+
module Aws
|
6
|
+
module Cfn
|
7
|
+
module Stacker
|
8
|
+
# noinspection ALL
|
9
|
+
module Main
|
10
|
+
|
11
|
+
# --------------------------------------------------------------------------------------------------------------
|
12
|
+
MY_NAME = "cfn-stacker"
|
13
|
+
NO_COMMAND_GIVEN = "You need to pass a sub-command (e.g., #{MY_NAME} SUB-COMMAND or #{MY_NAME} -a|--action SUB-COMMAND)\n"
|
14
|
+
|
15
|
+
# --------------------------------------------------------------------------------------------------------------
|
16
|
+
attr_accessor :logger
|
17
|
+
attr_accessor :verbosity
|
18
|
+
attr_accessor :LOGLEVELS
|
19
|
+
attr_accessor :ALLACTIONS
|
20
|
+
# --------------------------------------------------------------------------------------------------------------
|
21
|
+
|
22
|
+
# --------------------------------------------------------------------------------------------------------------
|
23
|
+
module ClassMethods
|
24
|
+
|
25
|
+
def loglevels
|
26
|
+
@LOGLEVELS
|
27
|
+
end
|
28
|
+
|
29
|
+
def loglevels=(levels)
|
30
|
+
@LOGLEVELS = levels || [:trace, :debug, :step, :info, :warn, :error, :fatal, :todo]
|
31
|
+
end
|
32
|
+
|
33
|
+
def allactions
|
34
|
+
@ALLACTIONS
|
35
|
+
end
|
36
|
+
|
37
|
+
def allactions=(acts)
|
38
|
+
@ALLACTIONS = acts || [ :build, :configure, :create, :status, :update, :delete, :outputs, :watch, :listparams ]
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
# --------------------------------------------------------------------------------------------------------------
|
45
|
+
def self.included(includer)
|
46
|
+
includer.extend(ClassMethods)
|
47
|
+
includer.class_eval do
|
48
|
+
self.loglevels = [:trace, :debug, :step, :info, :warn, :error, :fatal, :todo]
|
49
|
+
self.allactions = [ :build, :configure, :create, :status, :update, :delete, :outputs, :watch, :listparams ]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# --------------------------------------------------------------------------------
|
54
|
+
# Create a new instance of the current class configured for the given
|
55
|
+
# arguments and options
|
56
|
+
def initialize
|
57
|
+
$STKR = self
|
58
|
+
@TODO = {}
|
59
|
+
@defaultOptions = {}
|
60
|
+
|
61
|
+
super
|
62
|
+
end
|
63
|
+
|
64
|
+
# -----------------------------------------------------------------------------
|
65
|
+
def run(argv)
|
66
|
+
begin
|
67
|
+
@argv = argv
|
68
|
+
prescreen_options()
|
69
|
+
quiet_traps()
|
70
|
+
reconfigure()
|
71
|
+
setup_application()
|
72
|
+
run_application()
|
73
|
+
# reportTODO(@args)
|
74
|
+
exit 0
|
75
|
+
rescue StackerError => e
|
76
|
+
puts e.message.light_red
|
77
|
+
puts "#{__FILE__}::#{__LINE__} reraising ... "
|
78
|
+
raise e
|
79
|
+
exit -1
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# --------------------------------------------------------------------------------------------------------------
|
84
|
+
# private
|
85
|
+
# --------------------------------------------------------------------------------------------------------------
|
86
|
+
|
87
|
+
# --------------------------------------------------------------------------------------------------------------
|
88
|
+
def quiet_traps
|
89
|
+
trap("TERM") do
|
90
|
+
exit 1
|
91
|
+
end
|
92
|
+
|
93
|
+
trap("INT") do
|
94
|
+
exit 2
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Reconfigure the application. You'll want to override and super this method.
|
99
|
+
def reconfigure
|
100
|
+
configure_application
|
101
|
+
configure_logging
|
102
|
+
end
|
103
|
+
|
104
|
+
# Parse configuration (options and config file)
|
105
|
+
def configure_application
|
106
|
+
parse_options(ARGV)
|
107
|
+
load_config_file
|
108
|
+
end
|
109
|
+
|
110
|
+
# --------------------------------------------------------------------------------
|
111
|
+
|
112
|
+
# Parse the config file
|
113
|
+
def load_config_file(path=nil)
|
114
|
+
<<-EOC
|
115
|
+
Loads config files from a given path, or additional paths if not specified.
|
116
|
+
|
117
|
+
If a specific path isn't specified, loads the following locations:
|
118
|
+
- $CWD/config/config.ini
|
119
|
+
- $HOME/.stacker/config.ini
|
120
|
+
- /etc/stacker/config.ini
|
121
|
+
- /usr/local/etc/stacker/config.ini
|
122
|
+
|
123
|
+
Establishes default values for a handful of section variables:
|
124
|
+
- disable_rollback = 'true' - don't automatically rollback on error
|
125
|
+
- s3_bucket = 'amplify-sto-templates' - s3 bucket to upload templates to
|
126
|
+
if needed.
|
127
|
+
- cf_template_dir = $CWD/templates - location of CloudFormation templates
|
128
|
+
- stack_dir = $CWD/stacks - location where stack config directories are stored
|
129
|
+
- playbooks_dir = $CWD/ansible/playbooks
|
130
|
+
EOC
|
131
|
+
cwd = Dir.getwd()
|
132
|
+
|
133
|
+
defaults={
|
134
|
+
disable_rollback: true,
|
135
|
+
template_dir: File.join(cwd, 'templates'),
|
136
|
+
stack_dir: File.join(File.dirname(@options[:config_file]), 'stacks'),
|
137
|
+
playbooks_dir: File.join(cwd, 'ansible', 'playbooks')
|
138
|
+
}
|
139
|
+
#config = ConfigParser.ConfigParser(
|
140
|
+
|
141
|
+
paths = [
|
142
|
+
File.join(cwd,'config', 'config.ini'),
|
143
|
+
File.join(File.expand_path("~"), 'config.ini'),
|
144
|
+
'/etc/stacker/config.ini',
|
145
|
+
'/usr/local/etc/stacker/config.ini',
|
146
|
+
]
|
147
|
+
|
148
|
+
if path
|
149
|
+
paths.unshift path
|
150
|
+
end
|
151
|
+
config = nil
|
152
|
+
paths.each do |path|
|
153
|
+
begin
|
154
|
+
config = IniFile.load(path)
|
155
|
+
@inis << path
|
156
|
+
break
|
157
|
+
rescue => e
|
158
|
+
# noop
|
159
|
+
end
|
160
|
+
end
|
161
|
+
return config
|
162
|
+
end
|
163
|
+
|
164
|
+
def configure_logging
|
165
|
+
super
|
166
|
+
@config[:log_opts] = lambda{|mlll| {
|
167
|
+
:pattern => "%#{mlll}l: %m %C\n",
|
168
|
+
:date_pattern => '%Y-%m-%d %H:%M:%S',
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
@logger = getLogger(@config)
|
173
|
+
end
|
174
|
+
|
175
|
+
def configure_stdout_logger
|
176
|
+
end
|
177
|
+
|
178
|
+
# Called prior to starting the application, by the run method
|
179
|
+
def setup_application
|
180
|
+
raise ApplicationError, "#{self.to_s}: you must override setup_application"
|
181
|
+
end
|
182
|
+
|
183
|
+
# Actually run the application
|
184
|
+
def run_application
|
185
|
+
raise ApplicationError, "#{self.to_s}: you must override run_application"
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|