Revision 82a4e9ec
Added by Ewoud Kohl van Wijngaarden almost 3 years ago
hooks/pre/31-puppet_agent_oauth.rb | ||
---|---|---|
def oauth_aio_gem_installed?
|
||
return false unless File.exist?('/opt/puppetlabs/puppet/bin/ruby')
|
||
|
||
case facts['os']['family']
|
||
case facts[:os][:family]
|
||
when 'Debian'
|
||
execute("dpkg-query --show --showformat='${db:Status-Status}' puppet-agent-oauth | grep -q '^installed'", false, false)
|
||
when 'RedHat'
|
||
... | ... | |
end
|
||
|
||
def reinstall_oauth_aio_gem
|
||
case facts['os']['family']
|
||
case facts[:os][:family]
|
||
when 'Debian'
|
||
execute("apt-get --reinstall install puppet-agent-oauth", false, true)
|
||
when 'RedHat'
|
||
... | ... | |
if app_value(:noop)
|
||
logger.error('Detected broken puppet-agent-oauth; needs reinstall')
|
||
else
|
||
logger.debug('Detected broken puppet-agent-oauth; reinstalling')
|
||
success = reinstall_oauth_aio_gem
|
||
|
||
logger.error("Failed to reinstall puppet-agent-oauth. Please check that the package is available from a repository.") unless success
|
Also available in: Unified diff
Refs #33191 - Use symbols for facts
In 567172b6411ed9d0731614fd29455e8b7877ccd0 facts were incorrectly using
strings while it should use symbols.
It also adds a debug line to make it easier to follow what happened.
Fixes: 567172b6411ed9d0731614fd29455e8b7877ccd0