some additional changes

This commit is contained in:
John Bintz 2012-07-31 15:58:54 -04:00
parent b9231ec890
commit 00e10a4b96
3 changed files with 15 additions and 8 deletions

View File

@ -59,12 +59,20 @@ Capistrano::Configuration.instance.load do
top.copy_skel
end
def as_user(cmd)
if use_sudo
%{#{sudo} su -c "#{cmd}" #{user}}
else
cmd
end
end
desc "Apply the configuration"
task :apply do
top.copy_files
top.rename if rename_server && wrong_server_name?
run "cd #{puppet_dir} && #{sudo} ./apply"
run "cd #{puppet_dir} && #{as_user("./apply")}"
end
def wrong_server_name?
@ -76,12 +84,12 @@ Capistrano::Configuration.instance.load do
top.copy_files
top.rename if rename_server
run "cd #{puppet_dir} && #{sudo} ./bootstrap"
top.reboot
run "cd #{puppet_dir} && #{as_user("./bootstrap")}"
top.bootstrap_reboot
end
desc "Reboot the server after bootstrapping"
task :reboot do
task :bootstrap_reboot do
run "#{sudo} shutdown -r now"
end

View File

@ -1,7 +1,7 @@
#!/bin/bash
mkdir -p ~/.puppet
<%= use_sudo ? "sudo env" : "" %> RUBYLIB="${PWD}/lib:${PWD}/shared/lib" \
RUBYLIB="${PWD}/lib:${PWD}/shared/lib" \
<%= with_additional_puppet_bin_path %> \
puppet apply <%= additional_puppet_options %> \
--confdir=$PWD \

View File

@ -15,7 +15,7 @@ if [ ! -f ${base_dir}/ruby-base/bin/ruby ]; then
rm -Rf yaml-$YAML_VERSION*
curl http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz > yaml.tar.gz
tar zxvf c$yaml.tar.gz
tar zxvf yaml.tar.gz
mv yaml-$YAML_VERSION yaml-$YAML_VERSION-base
cd yaml-$YAML_VERSION-base
./configure --prefix=${opt_dir}
@ -49,5 +49,4 @@ if [ ! -f ${base_dir}/ruby-base/bin/puppet ]; then
fi
mkdir -p ~/.puppet
cd /tmp/puppet
./apply