Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #33 from willdurand/#27-check-config-parameter-bef…
Browse files Browse the repository at this point in the history
…ore-puppet-run

check whether the configuration parameter is already applied be…
  • Loading branch information
Ma27 committed Apr 2, 2016
2 parents 799685f + ff3be52 commit cc5728f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions manifests/config/entry.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,19 @@
default => "${cmd_template} --unset ${entry}"
}

$unless = $ensure ? {
present => "/usr/bin/test `${cmd_template} ${entry}` = ${value}",

# NOTE: in this case the parameter will be resetted to the default value so it cannot be checked properly
# when to execute the command to remove the command or not.
default => undef,
}

exec { "composer-config-entry-${entry}-${user}-${ensure}":
command => $cmd,
user => $user,
require => Class['::composer'],
environment => "HOME=${home_dir}",
unless => $unless
}
}
3 changes: 2 additions & 1 deletion spec/defines/composer_config_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
it { should contain_exec('composer-config-entry-\'process-timeout\'-vagrant-present') \
.with_command('/usr/local/bin/composer config -g \'process-timeout\' 500') \
.with_user('vagrant') \
.with_environment('HOME=/home/vagrant')
.with_environment('HOME=/home/vagrant') \
.with_unless('/usr/bin/test `/usr/local/bin/composer config -g \'process-timeout\'` = 500') \
}
end

Expand Down

0 comments on commit cc5728f

Please sign in to comment.