clean up some tasks

This commit is contained in:
John Bintz 2012-08-02 11:17:45 -04:00
parent 00e10a4b96
commit 5d8aefeee3
4 changed files with 9 additions and 2 deletions

View File

@ -33,6 +33,7 @@ Capistrano::Configuration.instance.load do
_cset(:rename_server) { true } _cset(:rename_server) { true }
_cset(:use_sudo) { true } _cset(:use_sudo) { true }
_cset(:run_as_user) { false }
_cset(:additional_modules) { [] } _cset(:additional_modules) { [] }
_cset(:additional_puppet_options) { '' } _cset(:additional_puppet_options) { '' }
@ -61,7 +62,11 @@ Capistrano::Configuration.instance.load do
def as_user(cmd) def as_user(cmd)
if use_sudo if use_sudo
if run_as_user
%{#{sudo} su -c "#{cmd}" #{user}} %{#{sudo} su -c "#{cmd}" #{user}}
else
%{#{sudo} #{cmd}}
end
else else
cmd cmd
end end

View File

@ -6,6 +6,7 @@ Capistrano::Configuration.instance.load do
set(:user) { 'vagrant' } set(:user) { 'vagrant' }
set(:password) { 'vagrant' } set(:password) { 'vagrant' }
set(:use_sudo) { true } set(:use_sudo) { true }
set(:run_as_user) { false }
task :ensure_puppet do task :ensure_puppet do
require 'socket' require 'socket'

View File

@ -67,6 +67,7 @@ class squid($version = '', $user = 'proxy', $group = 'proxy', $config_template,
command => "${sbin}/squid3 -z", command => "${sbin}/squid3 -z",
logoutput => true, logoutput => true,
require => Exec[cache_dir_perms, log_dir_params], require => Exec[cache_dir_perms, log_dir_params],
unless => "test -d ${cache_dir}/00",
path => $::base::path path => $::base::path
} }

View File

@ -3,7 +3,7 @@ define remotedeb($url, $version) {
exec { "remotedeb-${name}": exec { "remotedeb-${name}":
command => "curl -o ${deb} ${url} && dpkg -i ${deb}", command => "curl -o ${deb} ${url} && dpkg -i ${deb}",
unless => "test $(dpkg -l ${name} | grep ${version} | wc -l) -ne 0", unless => "test $(dpkg -l ${name} | grep ${version} | wc -l) -eq 0",
path => $base::path path => $base::path
} }
} }