Skip to content

Commit

Permalink
add parameter to specifify r10k binary to use in script
Browse files Browse the repository at this point in the history
  • Loading branch information
trefzer committed Jan 5, 2024
1 parent 62735d5 commit 5dbd2cb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
35 changes: 20 additions & 15 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
4 changes: 2 additions & 2 deletions templates/update_environment.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
2 changes: 1 addition & 1 deletion templates/update_module.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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)')

0 comments on commit 5dbd2cb

Please sign in to comment.