Skip to content

Commit

Permalink
(maint) improve the ntp/dhcp disintegration to actually do something
Browse files Browse the repository at this point in the history
If the SUT doesn't have ntp installed at the beginning of the test run
(like ubuntu 12.04) or when the package is removed and re-installed, the
original code would not have deleted the hook script, as it was not
available yet or would have been reinstated. Installing the package
through the class then installed the hook and lead to failures of the
kind this was trying to avoid. using dpkg-divert instead will move the
file away everytime the package is installed by dpkg.

# Conflicts:
#	spec/spec_helper_acceptance.rb
  • Loading branch information
DavidS committed Jul 16, 2015
1 parent c872c03 commit 2a5b0ca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
on host, puppet('module install puppetlabs-stdlib')
end

#Need to disable update of ntp servers from DHCP, as subsequent restart of ntp causes test failures
if fact('osfamily') == 'Debian'
shell('[[ -f /etc/dhcp/dhclient-exit-hooks.d/ntp ]] && rm /etc/dhcp/dhcp-exit-hooks.d/ntp', { :acceptable_exit_codes => [0, 1] })
shell('[[ -f /etc/dhcp3/dhclient-exit-hooks.d/ntp ]] && rm /etc/dhcp3/dhcp-exit-hooks.d/ntp', { :acceptable_exit_codes => [0, 1] })
elsif fact('osfamily') == 'RedHat'
shell('echo "PEERNTP=no" >> /etc/sysconfig/network', { :acceptable_exit_codes => [0, 1]})
# Need to disable update of ntp servers from DHCP, as subsequent restart of ntp causes test failures
if fact_on(host, 'osfamily') == 'Debian'
on host, 'dpkg-divert --divert /etc/dhcp-ntp.bak --local --rename --add /etc/dhcp/dhclient-exit-hooks.d/ntp'
on host, 'dpkg-divert --divert /etc/dhcp3-ntp.bak --local --rename --add /etc/dhcp3/dhclient-exit-hooks.d/ntp'
elsif fact_on(host, 'osfamily') == 'RedHat'
on host, 'echo "PEERNTP=no" >> /etc/sysconfig/network'
end
end
end
Expand Down

0 comments on commit 2a5b0ca

Please sign in to comment.