cloudformer 0.0.15 → 0.0.17

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d73f33d587566af345ac12ff9f23ded51b40e7aa
4
- data.tar.gz: a076a3d80f49a9d220648ceb875a7038be48a637
3
+ metadata.gz: ad4b308e721c4df1b83ca3ade6fcca758ffc3faf
4
+ data.tar.gz: e91c88820ec3740d05edd8c0771f9e937d8b1381
5
5
  SHA512:
6
- metadata.gz: 3cd414de1fce5d96b62e635d7cb2a0abf4e916f3e171cfa546ffc325c3a1bd723af79ba909b9758c696dbf5ba5eaaa5f3b45f3788e67a5b7a0c498e7ad0fbef7
7
- data.tar.gz: ff101f7dbdc08898a5d9880ced8203daceeae40bae64430786f2dbcfc3517a12d01ff8c57a173f0d9024c0384448f9e7c6d120354bcd6f56d4b59c36906867ad
6
+ metadata.gz: c9f8339440ca0326d644b6a3e0c1dad5f22f77459adeb40146935501a479f1ed461f75cee629f77459ad73896e084462c2f6552ecfc5b9a91a1834ac550191f8
7
+ data.tar.gz: 87eba56a105dc4f5a7255fb86f36e5a479f4fda4d933835edb5f56b2bdaaf69bc2c988564f9aa7e5655c87da2415ee5a771bb08a3892c39b6c1a4f75eac0199a
data/README.md CHANGED
@@ -52,8 +52,8 @@ You can add cloudformer tasks to your project by adding the following to your ra
52
52
  end
53
53
 
54
54
  where `cloudformation/cloudformation.json` is the stack json file and parameters is a hash of parameters used in the template.
55
- For a template which takes the following parameters:
56
-
55
+ For a template which takes the following parameters:
56
+
57
57
  "Parameters": {
58
58
  "PackageUrl": {
59
59
  "Type": "String"
@@ -62,13 +62,13 @@ For a template which takes the following parameters:
62
62
  "Type": "String"
63
63
  }
64
64
  }
65
-
65
+
66
66
  the parameter hash(Ruby Object) would look like:
67
67
 
68
68
  {
69
69
  "PackageUrl" => "http://localhost/app.rpm",
70
- "PackageVersion" => "123"
71
- }
70
+ "PackageVersion" => "123"
71
+ }
72
72
 
73
73
  If you have a template with no parameters, pass an empty hash `{}` instead.
74
74
 
@@ -107,13 +107,16 @@ Here is a simple Cloudformation Stack(Code available in the samples directory) w
107
107
  }
108
108
  }
109
109
  }
110
-
111
- Then, in your Rakefile add,
110
+
111
+ Then, in your Rakefile add,
112
112
 
113
113
  require 'cloudformer/tasks'
114
114
 
115
115
  Cloudformer::Tasks.new("app") do |t|
116
116
  t.template = "basic_template.json"
117
+ t.tags = [{'Key' => 'Name', 'Value' => 'BASIC-TMPLT'},
118
+ {'Key' => 'Owner', 'Value' => 'APPOWNER'}]
119
+
117
120
  #AMI Works in Sydney region only, ensure you supply the right AMI.
118
121
  t.parameters = {"AmiId" => "ami-8da439b7"}
119
122
  end
@@ -145,7 +148,7 @@ Running `rake apply` will create an environment or update existing depending on
145
148
  ==================================================================================================
146
149
 
147
150
  Running `rake apply` again gives us:
148
-
151
+
149
152
  No updates are to be performed.
150
153
 
151
154
  To remove the stack `rake delete` gives us:
@@ -170,7 +173,7 @@ Attempts to delete a non-existing stack will result in:
170
173
  ==============================================
171
174
 
172
175
  To recreate the stack use `rake recreate`:
173
-
176
+
174
177
  =================================================================================================
175
178
  Attempting to delete stack - app
176
179
  =================================================================================================
@@ -194,13 +197,13 @@ To recreate the stack use `rake recreate`:
194
197
  =================================================================================================
195
198
 
196
199
  To see the stack outputs `rake outputs`:
197
-
200
+
198
201
  ==============================
199
202
  Server - - 172.31.3.52
200
- ==============================
203
+ ==============================
201
204
 
202
205
  To see recent events on the stack `rake events`:
203
-
206
+
204
207
  ==================================================================================================
205
208
  2013-10-24 08:06:31 UTC - AWS::CloudFormation::Stack - CREATE_IN_PROGRESS - User Initiated
206
209
  2013-10-24 08:06:52 UTC - AWS::EC2::Instance - CREATE_IN_PROGRESS -
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency "rspec"
23
23
  spec.add_dependency "rake"
24
24
  spec.add_dependency "aws-sdk"
25
+ spec.add_dependency "httparty"
25
26
  end
@@ -3,5 +3,4 @@ require "cloudformer/stack"
3
3
  require "cloudformer/tasks"
4
4
 
5
5
  module Cloudformer
6
-
7
6
  end
@@ -1,4 +1,5 @@
1
1
  require 'aws-sdk'
2
+ require 'httparty'
2
3
 
3
4
  class Stack
4
5
  attr_accessor :stack, :name, :deployed
@@ -19,9 +20,17 @@ class Stack
19
20
  return stack.exists?
20
21
  end
21
22
 
22
- def apply(template_file, parameters, disable_rollback=false, capabilities=[], notify=[])
23
+ def apply(template_file, parameters, disable_rollback=false, capabilities=[], notify=[], tags=[])
23
24
  if ( template_file =~ /^https:\/\/s3\S+\.amazonaws\.com\/(.*)/ )
24
25
  template = template_file
26
+ elsif ( template_file =~ /^http.*(.json)$/ )
27
+ begin
28
+ response = HTTParty.get(template_file)
29
+ template = response.body
30
+ rescue => e
31
+ puts "Unable to retieve json file for template from #{template_file} - #{e.class}, #{e}"
32
+ return :Failed
33
+ end
25
34
  else
26
35
  template = File.read(template_file)
27
36
  end
@@ -35,7 +44,7 @@ class Stack
35
44
  if deployed
36
45
  pending_operations = update(template, parameters, capabilities)
37
46
  else
38
- pending_operations = create(template, parameters, disable_rollback, capabilities, notify)
47
+ pending_operations = create(template, parameters, disable_rollback, capabilities, notify, tags)
39
48
  end
40
49
  rescue ::AWS::CloudFormation::Errors::ValidationError => e
41
50
  puts e.message
@@ -154,9 +163,9 @@ class Stack
154
163
  return true
155
164
  end
156
165
 
157
- def create(template, parameters, disable_rollback, capabilities, notify)
166
+ def create(template, parameters, disable_rollback, capabilities, notify, tags)
158
167
  puts "Initializing stack creation..."
159
- @cf.stacks.create(name, template, :parameters => parameters, :disable_rollback => disable_rollback, :capabilities => capabilities, :notify => notify)
168
+ @cf.stacks.create(name, template, :parameters => parameters, :disable_rollback => disable_rollback, :capabilities => capabilities, :notify => notify, :tags => tags)
160
169
  sleep 10
161
170
  return true
162
171
  end
@@ -13,7 +13,7 @@ module Cloudformer
13
13
  end
14
14
  end
15
15
 
16
- attr_accessor :template, :parameters, :disable_rollback, :retry_delete, :capabilities, :notify
16
+ attr_accessor :template, :parameters, :disable_rollback, :retry_delete, :capabilities, :notify, :tags
17
17
 
18
18
  private
19
19
  def define_tasks
@@ -35,7 +35,7 @@ module Cloudformer
35
35
  if retry_delete
36
36
  @stack.delete
37
37
  end
38
- result = @stack.apply(template, parameters, disable_rollback, capabilities, notify)
38
+ result = @stack.apply(template, parameters, disable_rollback, capabilities, notify, tags)
39
39
  if result == :Failed then exit 1 end
40
40
  if result == :NoUpdates then exit 0 end
41
41
  end
@@ -1,3 +1,3 @@
1
1
  module Cloudformer
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.17"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arvind Kunday
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-02 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Cloudformation tasks for apply(create/update), delete, recreate on stack
70
84
  along with validations on templates
71
85
  email: