Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MODULES-6363) fix disabling dhclient on redhat-derivatives #439

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,12 @@
file { '/var/lib/ntp/ntp.conf.dhcp':
ensure => absent,
}

#remove dhclient ntp script which modifies ntp.conf on RHEL and Amazon Linux
#backup created in case admin wants to revert back to dhclient
file { '/etc/dhcp/dhclient.d/ntp.sh':
ensure => absent,
backup => true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would unexpectedly override global file bucket policy, I think this should be left up to user of the module, or make it configurable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean for creating a backup?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

Copy link
Contributor Author

@sudodevnull sudodevnull Feb 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. Also, please ignore my many commits... first time writing testing, and fighting the travis ci.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer will ask you to squash them into one, when it's finalized

}
}
}
39 changes: 39 additions & 0 deletions spec/acceptance/disable_dhclient_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'spec_helper_acceptance'

describe 'ntp class with disable_dhclient:', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
context 'with should disable' do
let(:pp) { "class { 'ntp': disable_dhclient => true }" }

it 'runs twice' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe file('/files/etc/dhcp/dhclient.conf') do
its(:content) { is_expected.not_to match('ntp-servers') }
end

it {
should contain_file('/etc/dhcp/dhclient.d/ntp.sh').with(
'ensure' => 'absent',
'backup' => 'true',
)
should contain_file('/var/lib/ntp/ntp.conf.dhcp').with(
'ensure' => 'absent',
)
}
end

context 'when enabled' do
let(:pp) { "class { 'ntp': disable_dhclient => false }" }

it 'runs twice' do
apply_manifest(pp, catch_failures: true)
apply_manifest(pp, catch_changes: true)
end

describe file('/files/etc/dhcp/dhclient.conf') do
its(:content) { is_expected.to match('ntp-servers') }
end
end
end
1 change: 0 additions & 1 deletion spec/acceptance/disable_monitoring_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
describe file(config.to_s) do
its(:content) { is_expected.to match('disable monitor') }
end
end

context 'when enabled' do
let(:pp) { "class { 'ntp': disable_monitor => false }" }
Expand Down