Permalink
Browse files

Support data bags

Transfering data bags directory and write path configration to solo.rb.
chef-solo (>= 0.10.4) is needed to use data bugs with chef-solo.
  • Loading branch information...
1 parent ffdfc12 commit ba53ddc577231b5e600ea9828ee8862c95ecc32f @tk0miya tk0miya committed with Arie Feb 4, 2013
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/roundsman/capistrano.rb
@@ -174,6 +174,7 @@ def ensure_supported_distro
set_default :chef_version, "~> 10.18.2"
set_default :cookbooks_directory, ["config/cookbooks"]
+ set_default :databags_directory, "config/data_bags"
set_default :copyfile_disable, false
set_default :verbose_logging, true
set_default :filter_sensitive_settings, [ /password/, /filter_sensitive_settings/ ]
@@ -227,6 +228,11 @@ def cookbooks_paths
Array(fetch(:cookbooks_directory)).select { |path| File.exist?(path) }
end
+ def databags_path
+ path = fetch(:databags_directory)
+ File.exist?(path) ? path : nil
+ end
+
def install_chef?
required_version = fetch(:chef_version).inspect
output = capture("gem list -i -v #{required_version} || true").strip
@@ -240,6 +246,7 @@ def generate_config
file_cache_path File.join(root, "cache")
cookbook_path [ #{cookbook_string} ]
verbose_logging #{fetch(:verbose_logging)}
+ data_bag_path File.join(root, #{fetch(:databags_directory).to_s.inspect})
RUBY
put solo_rb, roundsman_working_dir("solo.rb"), :via => :scp
end
@@ -282,7 +289,7 @@ def copy_cookbooks
begin
tar_file.close
env_vars = fetch(:copyfile_disable) && RUBY_PLATFORM.downcase.include?('darwin') ? "COPYFILE_DISABLE=true" : ""
- system "#{env_vars} tar -cjf #{tar_file.path} #{cookbooks_paths.join(' ')}"
+ system "#{env_vars} tar -cjf #{tar_file.path} #{cookbooks_paths.join(' ')} #{databags_path.to_s}"
upload tar_file.path, roundsman_working_dir("cookbooks.tar"), :via => :scp
run "cd #{roundsman_working_dir} && tar -xjf cookbooks.tar"
ensure

0 comments on commit ba53ddc

Please sign in to comment.