cloudformation-tool 0.6.0 → 0.6.3

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: c314efbe154da6923670e1db9e1d51dbe11ade89
4
- data.tar.gz: 81803828778634c0e7fec5c5efc49f17f5fb5aff
3
+ metadata.gz: 94cf14cf65ed21845906c4101a74e8bdf04aef9c
4
+ data.tar.gz: cff797604a819f29b3a9d442e260c714c031b9b0
5
5
  SHA512:
6
- metadata.gz: 5ba0caf5fefe37f31ebfe74bb18537a393a1a163f1ae5fcbd48069e81cfb8e5e201347434ab8481d380d70735a94e0b4bd49300699151bf819f82dcc8ea0a5e7
7
- data.tar.gz: 726c7b5c0bafe15e46271b7f11b5b198d99e1a7ad8e8867310bfcd00d095e3407fe0946a47d482ca89da8e1d4b8046728fbb0d7edc6eaba3b4ef12b5238752aa
6
+ metadata.gz: ab8abfdfdc092df31ed5b1de0f8d73f16edb35285646df0445bdc60b15d2f41904309d4f36d376ee24a789f26e8233476720f32f6e68d4d976c1d1d06632b789
7
+ data.tar.gz: 09dc1249e7734e35dc44f14093d7a6e90f23a56e842184020bd718fd265513acbdb570a58d8776eaa587028378b8d73246b637e79efa93b109a247d6cc6dd220
data/README.md CHANGED
@@ -125,7 +125,7 @@ user-data block, it will first be compressed using gzip and if it is still too l
125
125
  be uploaded to S3 and the user-data block will be set with a cloud-init download reference to
126
126
  the S3 object.
127
127
 
128
- ##### Enhanced write_files
128
+ ##### Enhanced `write_files`
129
129
 
130
130
  The ("Cloud Config data" format supports deploying files)[http://cloudinit.readthedocs.io/en/latest/topics/examples.html#writing-out-arbitrary-files]
131
131
  into the instance using the `write_files` module. This normally requires the file content
@@ -137,8 +137,24 @@ are binary, or just too large).
137
137
  To use an external file in `write_files` instead of specifying the file content using the
138
138
  `content` field, use a `file` field to specify the relative path to the file to be loaded.
139
139
 
140
+ ##### `write_directories`
141
+
142
+ In the case that you want to deploy multiple files to the same directory, instead of
143
+ listing each and every file as a `write_files` entries (which can get tedious after
144
+ a while, even with the `file` extension), `cftool` offers another cloud-init extension
145
+ as a category named `write_directories`.
146
+
147
+ The `write_directories` section is a list where each entry specifies a local
148
+ directory that would be deployed (with all files it includes, recursively - so make
149
+ sure it only includes files you want to deploy) to a target directory on the deployed
150
+ server. For each entry specify a `source` attribute that points to a local directory
151
+ relative to the location of the cloud-init file, and a `target` attribute set to an
152
+ absolute URL to where to deploy the source directory.
153
+
140
154
  #### Example:
141
155
 
156
+ `cloud-formation.yaml`:
157
+
142
158
  ```
143
159
  LaunchConfigurationForServer:
144
160
  Type: AWS::AutoScaling::LaunchConfiguration
@@ -154,6 +170,21 @@ To use an external file in `write_files` instead of specifying the file content
154
170
  File: config.init
155
171
  ```
156
172
 
173
+ `config.init`:
174
+
175
+ ```
176
+ #cloud-config
177
+
178
+ write_files:
179
+ - path: /etc/default/my-app
180
+ permissions: '0755'
181
+ file: my-app.config
182
+
183
+ write_directory:
184
+ - source: my-app-data
185
+ target: /usr/share/my-app
186
+ ```
187
+
157
188
  ### Loading Lambda code
158
189
 
159
190
  When specifying the `Code` property of a `AWS::Lambda::Function` resource, instead of
@@ -29,19 +29,21 @@ module CloudFormationTool
29
29
 
30
30
  def update(url, filepath, params = {})
31
31
  log "Updating existing stack '#{name}' from '#{filepath}' params #{params.inspect}"
32
- resp = awscf.update_stack({
33
- stack_name: @name,
34
- template_url: url,
35
- capabilities: %w(CAPABILITY_IAM CAPABILITY_NAMED_IAM),
36
- parameters: params.collect do |k,v|
37
- {
38
- parameter_key: k.to_s,
39
- parameter_value: v.to_s,
40
- use_previous_value: false,
41
- }
42
- end
43
- })
44
- resp.stack_id
32
+ check do
33
+ resp = awscf.update_stack({
34
+ stack_name: @name,
35
+ template_url: url,
36
+ capabilities: %w(CAPABILITY_IAM CAPABILITY_NAMED_IAM),
37
+ parameters: params.collect do |k,v|
38
+ {
39
+ parameter_key: k.to_s,
40
+ parameter_value: v.to_s,
41
+ use_previous_value: false,
42
+ }
43
+ end
44
+ })
45
+ resp.stack_id
46
+ end
45
47
  end
46
48
 
47
49
  def create(template, params = {})
@@ -49,7 +51,7 @@ module CloudFormationTool
49
51
  url = upload(make_filename('yaml'), @template, gzip: false)
50
52
  return update(url, template, params) if exist?
51
53
  log "Creating stack '#{name}' from '#{template}' params #{params.inspect}"
52
- begin
54
+ check do
53
55
  resp = awscf.create_stack({
54
56
  stack_name: @name,
55
57
  template_url: url,
@@ -64,8 +66,6 @@ module CloudFormationTool
64
66
  end
65
67
  })
66
68
  @stack_id = resp.stack_id
67
- rescue Aws::CloudFormation::Errors::ValidationError => e
68
- raise CloudFormationTool::Errors::ValidationError, "Stack validation error: #{e.message}"
69
69
  end
70
70
  end
71
71
 
@@ -171,6 +171,16 @@ module CloudFormationTool
171
171
  end
172
172
  end
173
173
  end
174
+
175
+ private
176
+
177
+ def check
178
+ begin
179
+ yield
180
+ rescue Aws::CloudFormation::Errors::ValidationError => e
181
+ raise CloudFormationTool::Errors::ValidationError, "Stack validation error: #{e.message}"
182
+ end
183
+ end
174
184
 
175
185
  end
176
186
  end
@@ -1,3 +1,3 @@
1
1
  module CloudFormationTool
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformation-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Arbel
@@ -28,14 +28,14 @@ dependencies:
28
28
  name: aws-sdk
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2'
41
41
  - !ruby/object:Gem::Dependency
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  requirements: []
105
105
  rubyforge_project:
106
- rubygems_version: 2.4.5
106
+ rubygems_version: 2.6.13
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: A pre-compiler tool for CloudFormation YAML templates