zergrush_cf 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWMzZjIyNWQ4NzJmYWUzYzNmNzg2NTgwZmM2NjY4OWIxYjMwMDIyNw==
4
+ ODdlMmM0ODNkOTU5ZTE5MTNiMTBmZGM2Y2JiYzhjM2VkYTM2ZWM4OA==
5
5
  data.tar.gz: !binary |-
6
- MjdiZDgwNmFlZmE5M2IxY2ZlNDVhZTUwYjJkNzExZjBiMWJlZDA1OQ==
6
+ YjgwMWRlNDg0YmY2M2MxNzkzNDU5YzNlOWU3ZGU0MjUwZjc3MGQyNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MTRlOTY3MzAyNDAyMDQ2MTI0Y2E0OWExYzhmMjg5ZDE3OWM5YjcwNTc1NTA5
10
- YzNjODA3MDA0ZmQ1MzJiYzM0MDc3NDY0NmYxNmM2ZjI5NjM0ZGYwODE1NDQz
11
- MDNlNGYzYWU5ZDY2Yzg4ZmUzNjg3MDY4MjZmY2VhZDdiMzkzYTI=
9
+ NGRmNjhlYzUyYTUwOWJkYjUxY2RjZTFhY2RlMjFjZmFlZTA0NDVkYzg1YWVl
10
+ NDJhYTQ0ZTQxODM4MjE3NWY4ODc2NzZhYWVmN2Q1NjA5ZTUxZGQzNjM2NzU5
11
+ MjM1YWVkNTI4MDZlZmJkNWU2ZmM4NzAzMzljNmNlYjdmOWNmMjE=
12
12
  data.tar.gz: !binary |-
13
- Y2Y3MmI1MmVkZGNkMTE1ZDNhZTEyMzEyOGYwNTcwMmI1ZmZiODM0M2E2Nzg3
14
- NjNjNDQ1MTg0OTA3YjI2MDM3YmYzODVlMDk4N2U2MmJlMDdmZDVhODQwYTA3
15
- MzcwNGM1ODNlYmM3Mzk5ODVmMDZhN2I3MTg0YmFkYTgyYTk5ZDg=
13
+ MzVjY2FlNDk1N2I1NDllZTFjY2M5MmFjYjc4MTUzMjdiMDVjNWQ2ZGVhM2E0
14
+ ZjRkYmRiODBiYTQ0MGI3ZDNjZTk4ZWI1M2EzNmExMTRkMjI1MjVjYTJjOGZj
15
+ MTFhMTg2Mjg3MGE1MjNmODU0YTg1ZTZiOTUzMzAwOWJlOTBjMTc=
data/README.md CHANGED
@@ -13,8 +13,9 @@ Additional properties defined
13
13
 
14
14
  - access_key_id - AWS access key id
15
15
  - secret_access_key - AWS secret.
16
- - template - body of a AWS CloudFormation template
17
- - template_parameters -
16
+ - template - body of a AWS CloudFormation template (use this OR template_file)
17
+ - template_file - file containing the CloudFormation template. Path is relative to location of .ke task file in .hive (use this OR template)
18
+ - template_parameters - parameter values for the cloudformation template
18
19
 
19
20
  Example use:
20
21
  ```
@@ -28,6 +29,7 @@ Example use:
28
29
  "template": {
29
30
  ...
30
31
  },
32
+ "template_file": "template_file.json",
31
33
  "template_parameters": {
32
34
  "Param1": "value",
33
35
  "Param2": "ENV['SOME_VARIABLE']"
@@ -22,6 +22,7 @@
22
22
  #++
23
23
 
24
24
  require 'fileutils'
25
+ require 'json'
25
26
 
26
27
  module ZergrushCF
27
28
  class Renderer
@@ -30,6 +31,7 @@ module ZergrushCF
30
31
  @vm = task_hash["vm"]
31
32
  @name = task_name
32
33
  @template = task_hash["vm"]["driver"]["driveroptions"][0]["template"]
34
+ @template_file = task_hash["vm"]["driver"]["driveroptions"][0]["template_file"]
33
35
  @driver = task_hash["vm"]["driver"]["drivertype"]
34
36
  @hive_location = hive_location
35
37
  end
@@ -37,14 +39,17 @@ module ZergrushCF
37
39
  def render
38
40
  puts ("Rendering driver templates...")
39
41
 
40
- # write cloudformation template to a separate file
41
- abort("CloudFormation template not specified!") unless @template != nil
42
+ abort("ERROR: Can't specify both template and template_file") unless @template == nil || @template_file == nil
43
+ abort("ERROR: Must specify template or template_file") unless @template != nil || @template_file != nil
44
+
45
+ template_body = (@template != nil) ? @template : JSON.parse( IO.read(File.join(@hive_location, @name, @template_file)) )
46
+
42
47
 
43
48
  puts ("Writing #{File.join(@hive_location, "driver", @driver, @name, "template.json")}...")
44
49
  FileUtils.mkdir_p(File.join(@hive_location, "driver", @driver, @name))
45
- File.open(File.join("#{@hive_location}", "driver", @vm["driver"]["drivertype"], @name, "template.json"), 'w') { |file| file.write(@template.to_json) }
50
+ File.open(File.join("#{@hive_location}", "driver", @vm["driver"]["drivertype"], @name, "template.json"), 'w') { |file| file.write(template_body.to_json) }
46
51
 
47
- return @template
52
+ return template_body
48
53
  end
49
54
  end
50
55
  end
@@ -22,5 +22,5 @@
22
22
  #++
23
23
 
24
24
  module ZergrushCF
25
- VERSION = "0.0.3"
25
+ VERSION = "0.0.4"
26
26
  end
@@ -7,6 +7,9 @@
7
7
  "template": {
8
8
  "type": "object"
9
9
  },
10
+ "template_file": {
11
+ "type": "string"
12
+ },
10
13
  "template_parameters": {
11
14
  "type": "object"
12
15
  },
data/zergrush_cf.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
 
18
18
  s.add_development_dependency "bundler", ">= 1.0.0"
19
19
  s.add_development_dependency "rake"
20
- s.add_development_dependency "zergrush", ">= 0.0.10"
20
+ s.add_development_dependency "zergrush", ">= 0.0.11"
21
21
 
22
22
  s.add_dependency "fog", ">=1.20.0"
23
23
  s.add_dependency "ruby-progressbar", "1.4.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zergrush_cf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - MTN Satellite Communications
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.10
47
+ version: 0.0.11
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.10
54
+ version: 0.0.11
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: fog
57
57
  requirement: !ruby/object:Gem::Requirement