mccloud 0.0.17 → 0.0.18
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.
- data/README.md +2 -0
- data/lib/mccloud/provider/core/vm/rsync.rb +10 -0
- data/lib/mccloud/provider/core/vm.rb +2 -0
- data/lib/mccloud/provisioner/chef_solo.rb +12 -0
- data/lib/mccloud/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -364,6 +364,7 @@ You can use multiple provisioners per vm
|
|
364
364
|
roles_path
|
365
365
|
provisioning_path
|
366
366
|
data_bags_path
|
367
|
+
encrypted_data_bag_secret_key_path
|
367
368
|
json
|
368
369
|
json_erb
|
369
370
|
clean_after_run
|
@@ -395,6 +396,7 @@ You can use multiple provisioners per vm
|
|
395
396
|
chef.cookbooks_path = [ "cookbooks", "site-cookbooks" ]
|
396
397
|
chef.roles_path = "roles"
|
397
398
|
chef.data_bags_path = "data_bags"
|
399
|
+
chef.encrypted_data_bag_secret_key_path = "my_databag_secret"
|
398
400
|
chef.clean_after_run = false
|
399
401
|
|
400
402
|
chef.json.merge!(n.default_attrs)
|
@@ -7,12 +7,22 @@ module Mccloud::Provider
|
|
7
7
|
@shared_folders << { :name => name, :dest => dest, :src => src, :options => new_options}
|
8
8
|
end
|
9
9
|
|
10
|
+
def share_file(name , dest,src,options={})
|
11
|
+
new_options={:mute => false}.merge(options)
|
12
|
+
@shared_files << { :name => name, :dest => dest, :src => src, :options => new_options}
|
13
|
+
end
|
14
|
+
|
10
15
|
def share
|
11
16
|
@shared_folders.each do |folder|
|
12
17
|
self.execute("test -d '#{folder[:dest]}' || mkdir -p '#{folder[:dest]}' ")
|
13
18
|
clean_src_path=File.join(Pathname.new(folder[:src]).expand_path.cleanpath.to_s,'/')
|
14
19
|
rsync(clean_src_path,folder[:dest],folder[:options])
|
15
20
|
end
|
21
|
+
@shared_files.each do |file|
|
22
|
+
self.execute("test -d '#{File.dirname(file[:dest])}' || mkdir -p '#{File.dirname(file[:dest])}' ")
|
23
|
+
clean_src_path=Pathname.new(file[:src]).expand_path.cleanpath.to_s
|
24
|
+
rsync(clean_src_path,file[:dest],file[:options])
|
25
|
+
end
|
16
26
|
end
|
17
27
|
|
18
28
|
def share_sync(src, dest, options = {})
|
@@ -51,6 +51,7 @@ module Mccloud
|
|
51
51
|
|
52
52
|
attr_accessor :forwardings
|
53
53
|
attr_accessor :shared_folders
|
54
|
+
attr_accessor :shared_files
|
54
55
|
attr_accessor :stacked
|
55
56
|
attr_accessor :declared
|
56
57
|
|
@@ -58,6 +59,7 @@ module Mccloud
|
|
58
59
|
@env=env
|
59
60
|
@forwardings=Array.new
|
60
61
|
@shared_folders = Array.new
|
62
|
+
@shared_files = Array.new
|
61
63
|
@stacked=false
|
62
64
|
@auto_selection=true
|
63
65
|
@declared=true
|
@@ -20,6 +20,7 @@ module Mccloud
|
|
20
20
|
attr_accessor :roles_path
|
21
21
|
attr_accessor :provisioning_path
|
22
22
|
attr_accessor :data_bags_path
|
23
|
+
attr_accessor :encrypted_data_bag_secret_key_path
|
23
24
|
attr_accessor :json
|
24
25
|
attr_accessor :json_erb
|
25
26
|
attr_accessor :clean_after_run
|
@@ -96,6 +97,7 @@ module Mccloud
|
|
96
97
|
configfile << "log_level #{log_level}"
|
97
98
|
configfile << "role_path \"/tmp/#{File.basename(roles_path)}\"" unless roles_path.nil?
|
98
99
|
configfile << "data_bag_path \"/tmp/#{File.basename(data_bags_path)}\"" unless data_bags_path.nil?
|
100
|
+
configfile << "encrypted_data_bag_secret \"/tmp/#{File.basename(encrypted_data_bag_secret_key_path)}\"" unless encrypted_data_bag_secret_key_path.nil?
|
99
101
|
|
100
102
|
#convert string to Tempfile (instead of StringIO), as server.transfer expects a file with a filename
|
101
103
|
temp_file_json = Tempfile.new("dna_json")
|
@@ -124,6 +126,10 @@ module Mccloud
|
|
124
126
|
server.share_folder("databags_path","/tmp/" + File.basename(data_bags_path),data_bags_path,{:mute => true})
|
125
127
|
end
|
126
128
|
|
129
|
+
unless encrypted_data_bag_secret_key_path.nil?
|
130
|
+
server.share_file("encrypted_databag_secret","/tmp/" + File.basename(encrypted_data_bag_secret_key_path),encrypted_data_bag_secret_key_path,{:mute => true})
|
131
|
+
end
|
132
|
+
|
127
133
|
server.share
|
128
134
|
|
129
135
|
env.ui.info "[#{server.name}] - [#{@name}] - running chef-solo"
|
@@ -157,6 +163,11 @@ module Mccloud
|
|
157
163
|
env.ui.info "[#{server.name}] - [#{@name}] - Cleaning data_bags_path #{data_bags_path}"
|
158
164
|
server.execute("rm -rf /tmp/#{File.basename(data_bags_path)}",{:mute => true})
|
159
165
|
end
|
166
|
+
|
167
|
+
unless encrypted_data_bag_secret_key_path.nil?
|
168
|
+
env.ui.info "[#{server.name}] - [#{@name}] - Cleaning encrypted_databag_secret #{encrypted_data_bag_secret_key_path}"
|
169
|
+
server.execute("rm -rf /tmp/#{File.basename(encrypted_data_bag_secret_key_path)}",{:mute => true})
|
170
|
+
end
|
160
171
|
end
|
161
172
|
end
|
162
173
|
|
@@ -240,6 +251,7 @@ module Mccloud
|
|
240
251
|
:recipe_url => config.recipe_url,
|
241
252
|
:roles_path => roles_path,
|
242
253
|
:data_bags_path => data_bags_path,
|
254
|
+
:encrypted_data_bag_secret_key_path => encrypted_data_bag_secret_key_path
|
243
255
|
})
|
244
256
|
end
|
245
257
|
def run_chef_solo
|
data/lib/mccloud/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mccloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 18
|
10
|
+
version: 0.0.18
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Debois
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-02-
|
18
|
+
date: 2013-02-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|