caterer 0.8.0 → 0.9.0
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/Gemfile +4 -0
- data/Vagrantfile +1 -1
- data/config/default.rb +3 -1
- data/lib/caterer/action/provisioner/load.rb +1 -1
- data/lib/caterer/config.rb +8 -8
- data/lib/caterer/config/base.rb +3 -2
- data/lib/caterer/config/provisioner.rb +8 -0
- data/lib/caterer/config/provisioner/base.rb +18 -0
- data/lib/caterer/config/provisioner/chef_solo.rb +19 -0
- data/lib/caterer/provisioner/chef_solo.rb +23 -22
- data/lib/caterer/version.rb +1 -1
- data/lib/templates/provisioner/chef_solo/solo.erb +1 -1
- metadata +5 -2
data/Gemfile
CHANGED
data/Vagrantfile
CHANGED
@@ -5,7 +5,7 @@ require 'vagrant-vbguest' unless defined? VagrantVbguest::Config
|
|
5
5
|
|
6
6
|
Vagrant::Config.run do |config|
|
7
7
|
|
8
|
-
config.berkshelf.config_path = './knife.rb'
|
8
|
+
# config.berkshelf.config_path = './knife.rb'
|
9
9
|
|
10
10
|
config.vm.box = "precise64"
|
11
11
|
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
|
data/config/default.rb
CHANGED
data/lib/caterer/config.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module Caterer
|
2
2
|
module Config
|
3
|
-
autoload :Base,
|
4
|
-
autoload :Berkshelf,
|
5
|
-
autoload :Cluster,
|
6
|
-
autoload :Group,
|
7
|
-
autoload :Member,
|
8
|
-
autoload :Node,
|
9
|
-
autoload :Image,
|
10
|
-
autoload :
|
3
|
+
autoload :Base, 'caterer/config/base'
|
4
|
+
autoload :Berkshelf, 'caterer/config/berkshelf'
|
5
|
+
autoload :Cluster, 'caterer/config/cluster'
|
6
|
+
autoload :Group, 'caterer/config/group'
|
7
|
+
autoload :Member, 'caterer/config/member'
|
8
|
+
autoload :Node, 'caterer/config/node'
|
9
|
+
autoload :Image, 'caterer/config/image'
|
10
|
+
autoload :Provisioner, 'caterer/config/provisioner'
|
11
11
|
end
|
12
12
|
end
|
data/lib/caterer/config/base.rb
CHANGED
@@ -9,7 +9,6 @@ module Caterer
|
|
9
9
|
@images = {}
|
10
10
|
@groups = {}
|
11
11
|
@keys = {}
|
12
|
-
@default_provisioner = :chef_solo
|
13
12
|
end
|
14
13
|
|
15
14
|
def image(name)
|
@@ -45,4 +44,6 @@ module Caterer
|
|
45
44
|
|
46
45
|
end
|
47
46
|
end
|
48
|
-
end
|
47
|
+
end
|
48
|
+
|
49
|
+
Caterer.config_keys.register(:provisioner) { Caterer::Config::Provisioner::Base }
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Caterer
|
2
|
+
module Config
|
3
|
+
module Provisioner
|
4
|
+
class Base
|
5
|
+
attr_accessor :default_engine
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@keys = {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def chef_solo
|
12
|
+
@keys[:chef_solo] ||= Config::Provisioner::ChefSolo.new
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Caterer
|
2
|
+
module Config
|
3
|
+
module Provisioner
|
4
|
+
class ChefSolo
|
5
|
+
attr_accessor :dest_dir, :run_list, :json, :cookbooks_path, :roles_path, :data_bags_path, :bootstrap_scripts
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@dest_dir = '/opt/cater_chef_solo'
|
9
|
+
@run_list = []
|
10
|
+
@json = {}
|
11
|
+
@cookbooks_path = ['cookbooks', 'vendor/cookbooks']
|
12
|
+
@roles_path = ['roles']
|
13
|
+
@data_bags_path = ['data_bags']
|
14
|
+
@bootstrap_scripts = []
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -9,16 +9,17 @@ module Caterer
|
|
9
9
|
class ChefSolo < Base
|
10
10
|
|
11
11
|
attr_reader :run_list
|
12
|
-
attr_accessor :json, :cookbooks_path, :roles_path
|
12
|
+
attr_accessor :dest_dir, :json, :cookbooks_path, :roles_path
|
13
13
|
attr_accessor :data_bags_path, :bootstrap_scripts
|
14
14
|
|
15
15
|
def initialize
|
16
|
-
@
|
17
|
-
@
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@
|
21
|
-
@
|
16
|
+
@dest_dir = config.dest_dir
|
17
|
+
@run_list = config.run_list
|
18
|
+
@json = config.json
|
19
|
+
@cookbooks_path = config.cookbooks_path
|
20
|
+
@roles_path = config.roles_path
|
21
|
+
@data_bags_path = config.data_bags_path
|
22
|
+
@bootstrap_scripts = config.bootstrap_scripts
|
22
23
|
end
|
23
24
|
|
24
25
|
# config DSL
|
@@ -121,8 +122,8 @@ module Caterer
|
|
121
122
|
|
122
123
|
def prepare(server)
|
123
124
|
# create base dir
|
124
|
-
server.ssh.sudo "mkdir -p #{
|
125
|
-
server.ssh.sudo "chown -R #{server.username} #{
|
125
|
+
server.ssh.sudo "mkdir -p #{dest_dir}", :stream => true
|
126
|
+
server.ssh.sudo "chown -R #{server.username} #{dest_dir}", :stream => true
|
126
127
|
end
|
127
128
|
|
128
129
|
def install(server)
|
@@ -185,7 +186,7 @@ module Caterer
|
|
185
186
|
server.ssh.upload(StringIO.new(json_config(config_data.merge(server.data))), target_json_config_path)
|
186
187
|
|
187
188
|
# set permissions on everything
|
188
|
-
server.ssh.sudo "chown -R #{server.username} #{
|
189
|
+
server.ssh.sudo "chown -R #{server.username} #{dest_dir}", :stream => true
|
189
190
|
|
190
191
|
# run
|
191
192
|
server.ui.info "Running chef-solo..."
|
@@ -216,47 +217,47 @@ module Caterer
|
|
216
217
|
def uninstall(server)
|
217
218
|
server.ui.info "Uninstalling..."
|
218
219
|
|
219
|
-
server.ssh.sudo "rm -rf #{
|
220
|
+
server.ssh.sudo "rm -rf #{dest_dir}", :stream => true
|
220
221
|
end
|
221
222
|
|
222
223
|
protected
|
223
224
|
|
225
|
+
def config
|
226
|
+
@config ||= Caterer.config.provisioner.chef_solo
|
227
|
+
end
|
228
|
+
|
224
229
|
def with_bootstrap_scripts
|
225
230
|
bootstrap_scripts.each_with_index do |script, index|
|
226
231
|
yield script, index if block_given?
|
227
232
|
end
|
228
233
|
end
|
229
234
|
|
230
|
-
def target_base_path
|
231
|
-
"/tmp/cater-chef-solo"
|
232
|
-
end
|
233
|
-
|
234
235
|
def target_install_path
|
235
|
-
"#{
|
236
|
+
"#{dest_dir}/install"
|
236
237
|
end
|
237
238
|
|
238
239
|
def target_bootstrap_path
|
239
|
-
"#{
|
240
|
+
"#{dest_dir}/bootstrap"
|
240
241
|
end
|
241
242
|
|
242
243
|
def target_cookbooks_path
|
243
|
-
"#{
|
244
|
+
"#{dest_dir}/cookbooks"
|
244
245
|
end
|
245
246
|
|
246
247
|
def target_roles_path
|
247
|
-
"#{
|
248
|
+
"#{dest_dir}/roles"
|
248
249
|
end
|
249
250
|
|
250
251
|
def target_data_bags_path
|
251
|
-
"#{
|
252
|
+
"#{dest_dir}/data_bags"
|
252
253
|
end
|
253
254
|
|
254
255
|
def target_solo_path
|
255
|
-
"#{
|
256
|
+
"#{dest_dir}/solo.rb"
|
256
257
|
end
|
257
258
|
|
258
259
|
def target_json_config_path
|
259
|
-
"#{
|
260
|
+
"#{dest_dir}/config.json"
|
260
261
|
end
|
261
262
|
|
262
263
|
def install_script
|
data/lib/caterer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caterer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: log4r
|
@@ -231,6 +231,9 @@ files:
|
|
231
231
|
- lib/caterer/config/group.rb
|
232
232
|
- lib/caterer/config/image.rb
|
233
233
|
- lib/caterer/config/member.rb
|
234
|
+
- lib/caterer/config/provisioner.rb
|
235
|
+
- lib/caterer/config/provisioner/base.rb
|
236
|
+
- lib/caterer/config/provisioner/chef_solo.rb
|
234
237
|
- lib/caterer/environment.rb
|
235
238
|
- lib/caterer/logger.rb
|
236
239
|
- lib/caterer/provisioner.rb
|