diff --git a/manifests/init.pp b/manifests/init.pp index aa59653..b0feaa3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -58,23 +58,28 @@ # eg. this lets you install r10k from gem by # setting this to: # { 'provider' => 'gem' } +# @param r10k_command +# r10k command, if it is not saved in path, +# you can specify the command with the path # class r10k ( - String $configdir = '/etc/puppet', - Optional[String[1]] $cachedir = undef, - Optional[Integer] $pool_size = undef, - Optional[String[1]] $proxy = undef, - Optional[Hash] $sources = undef, - Optional[Hash] $git = undef, - Optional[Hash] $forge = undef, - Optional[Hash] $deploy = undef, - String $user = 'r10k', - String $home = '/var/lib/r10k', - Boolean $ensure_user = true, - Array $allowed_keys = [], - Array $packages = ['r10k'], - String[1] $package_ensure = 'installed', - Hash[String[1],String[1]] $package_options = {}, + String $configdir = '/etc/puppet', + Boolean $ensure_configdir = false, + Optional[String[1]] $cachedir = undef, + Optional[Integer] $pool_size = undef, + Optional[String[1]] $proxy = undef, + Optional[Hash] $sources = undef, + Optional[Hash] $git = undef, + Optional[Hash] $forge = undef, + Optional[Hash] $deploy = undef, + String $user = 'r10k', + String $home = '/var/lib/r10k', + Boolean $ensure_user = true, + Array $allowed_keys = [], + Array $packages = ['r10k'], + String[1] $package_ensure = 'installed', + Hash[String[1],String[1]] $package_options = {}, + String[1] $r10k_command = 'r10k', ) { if $ensure_user { class { 'r10k::user': diff --git a/templates/update_environment.sh.erb b/templates/update_environment.sh.erb index 46ef140..5ea48ac 100644 --- a/templates/update_environment.sh.erb +++ b/templates/update_environment.sh.erb @@ -19,7 +19,7 @@ if [[ "$ENV" == 'MODULE' ]]; then echo "$ENV2 not allowed, only [A-Za-z0-9_]+ allowed as module" exit 1 fi - (cd <%= @configdir %>; r10k --config=r10k.yaml deploy --verbose=debug module $ENV2 2>&1 |grep -E '(ERROR|INFO|Updating)') + (cd <%= @configdir %>; <%= @r10k_command %> --config=r10k.yaml deploy --verbose=debug module $ENV2 2>&1 |grep -E '(ERROR|INFO|Updating)') else if [[ ! ( "$ENV2" == '' || "$ENV2" == '--puppetfile' ) ]]; then echo "only --puppetfile allowed as second argument" @@ -28,5 +28,5 @@ else if [[ $ENV == 'all' ]]; then ENV='' fi - (cd <%= @configdir %>; r10k --config=r10k.yaml deploy --verbose=debug environment $ENV $ENV2 2>&1 |grep -E '(ERROR|INFO|Updating)') + (cd <%= @configdir %>; <%= @r10k_command %> --config=r10k.yaml deploy --verbose=debug environment $ENV $ENV2 2>&1 |grep -E '(ERROR|INFO|Updating)') fi diff --git a/templates/update_module.sh.erb b/templates/update_module.sh.erb index a08f6c8..5b4233b 100644 --- a/templates/update_module.sh.erb +++ b/templates/update_module.sh.erb @@ -7,4 +7,4 @@ if [[ ! "$MODULE" =~ ^[A-Za-z0-9_]+$ ]]; then exit 1 fi -(cd <%= @configdir %>; r10k --config=r10k.yaml deploy --verbose=debug module $MODULE 2>&1 |grep -E '(ERROR|INFO|Updating)') +(cd <%= @configdir %>; <%= @r10k_command %> --config=r10k.yaml deploy --verbose=debug module $MODULE 2>&1 |grep -E '(ERROR|INFO|Updating)')