From d9614163ed327fc17d27ac623dfd639ce00a43ce Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 19 Jun 2013 13:41:23 -0400 Subject: disable dhclient from modifying the /etc/resolv.conf file on openstack/amazon instances The dhclient in these environments is quite aggressive and overwrites the nameservers we've deliberately chosen to use with google's nameservers. This commit attempts to fix that. The dhclient methodology for altering these things is particularly unpleasant. We effectively redefine the functions that mess with this file to be noops in the /etc/dhcp/dhclient-enter-hooks.d directory and then we are forced to restart dhclient by shipping a script that tries to determine the correct PID and arguments that it was running as before killing and restarting it with the same arguments. See debian bugs #681698, #712796 for further discussion about how to make this less difficult Change-Id: I51cf40cf98eaddcefd8180e157b6e3ca824173f0 --- puppet/modules/site_config/templates/reload_dhclient.erb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 puppet/modules/site_config/templates/reload_dhclient.erb (limited to 'puppet/modules/site_config/templates/reload_dhclient.erb') diff --git a/puppet/modules/site_config/templates/reload_dhclient.erb b/puppet/modules/site_config/templates/reload_dhclient.erb new file mode 100644 index 00000000..882c985a --- /dev/null +++ b/puppet/modules/site_config/templates/reload_dhclient.erb @@ -0,0 +1,13 @@ +#!/bin/sh + +# Get the PID +PIDFILE='/var/run/dhclient.<%= scope.lookupvar('site_config::params::interface') %>.pid + +# Capture how dhclient is currently running so we can relaunch it +dhclient=`/bin/ps --no-headers --pid $(cat $PIDFILE) -f | /usr/bin/awk '{for(i=8;i<=NF;++i) printf("%s ", $i) }'` + +# Kill the current dhclient +/usr/bin/pkill -F $PIDFILE + +# Restart dhclient with the arguments it had previously +$dhclient -- cgit v1.2.3 From 1d91ef608855059dbb7938dbd59adf2f70220139 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sun, 30 Jun 2013 19:35:32 -0400 Subject: Fix 'Failed to call refresh: /usr/local/sbin/reload_dhclient returned 2 instead of one of [0]' by putting in the missing closing single quote. Change-Id: I86feb5d06dd25e28ea67da0b5627e7be4174e01e --- puppet/modules/site_config/templates/reload_dhclient.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'puppet/modules/site_config/templates/reload_dhclient.erb') diff --git a/puppet/modules/site_config/templates/reload_dhclient.erb b/puppet/modules/site_config/templates/reload_dhclient.erb index 882c985a..075828b7 100644 --- a/puppet/modules/site_config/templates/reload_dhclient.erb +++ b/puppet/modules/site_config/templates/reload_dhclient.erb @@ -1,7 +1,7 @@ #!/bin/sh # Get the PID -PIDFILE='/var/run/dhclient.<%= scope.lookupvar('site_config::params::interface') %>.pid +PIDFILE='/var/run/dhclient.<%= scope.lookupvar('site_config::params::interface') %>.pid' # Capture how dhclient is currently running so we can relaunch it dhclient=`/bin/ps --no-headers --pid $(cat $PIDFILE) -f | /usr/bin/awk '{for(i=8;i<=NF;++i) printf("%s ", $i) }'` -- cgit v1.2.3