update NM DHCP dispatcher script

Updates the patch with downstream changes from
https://github.com/openshift/os/pull/486
and https://github.com/openshift/os/pull/494
This commit is contained in:
Christian Glombek 2021-02-01 16:32:54 +00:00 committed by Miroslav Lichvar
parent a565083d9b
commit 7f89c4666b
2 changed files with 23 additions and 23 deletions

View File

@ -1,4 +1,4 @@
From e0c6457fd42252f88ec60d16582b7b6e6fb04f41 Mon Sep 17 00:00:00 2001 From 1b29e43133d992e735ffbf87d79f008994479036 Mon Sep 17 00:00:00 2001
From: Robert Fairley <rfairley@redhat.com> From: Robert Fairley <rfairley@redhat.com>
Date: Wed, 17 Jun 2020 10:14:19 -0400 Date: Wed, 17 Jun 2020 10:14:19 -0400
Subject: [PATCH] examples/nm-dispatcher.dhcp: use sysconfig, detect dhclient Subject: [PATCH] examples/nm-dispatcher.dhcp: use sysconfig, detect dhclient
@ -7,27 +7,39 @@ Use the PEERNTP and NTPSERVERARGS environment variables from
/etc/sysconfig/network{-scripts}. Detect a dhclient install to avoid a /etc/sysconfig/network{-scripts}. Detect a dhclient install to avoid a
redundant operation with the 11-dhclient NM dispatcher in the redundant operation with the 11-dhclient NM dispatcher in the
dhcp-client package. dhcp-client package.
Co-Authored-By: Christian Glombek <cglombek@redhat.com>
--- ---
examples/chrony.nm-dispatcher.dhcp | 15 ++++++++++++++- examples/chrony.nm-dispatcher.dhcp | 21 +++++++++++++++++++--
1 file changed, 14 insertions(+), 1 deletion(-) 1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/examples/chrony.nm-dispatcher.dhcp b/examples/chrony.nm-dispatcher.dhcp diff --git a/examples/chrony.nm-dispatcher.dhcp b/examples/chrony.nm-dispatcher.dhcp
index 6ea4c37..878e72f 100644 index 6ea4c37..a6ad35a 100644
--- a/examples/chrony.nm-dispatcher.dhcp --- a/examples/chrony.nm-dispatcher.dhcp
+++ b/examples/chrony.nm-dispatcher.dhcp +++ b/examples/chrony.nm-dispatcher.dhcp
@@ -6,6 +6,11 @@ @@ -6,21 +6,39 @@
export LC_ALL=C export LC_ALL=C
+# If a dhclient installation is present, avoid a redundant operation +# If a dhclient installation is present, avoid a redundant operation
+# with dhclient which handles NTP server config through its own +# in case dhclient handles NTP server config through its own chrony config script,
+# NetworkManager dispatcher script 11-dhclient. +# exec'ed by NetworkManager's 11-dhclient dispatcher script.
+[ -e /usr/sbin/dhclient ] && exit 0 +# In RHCOS, 11-dhclient is excluded and not shipped with base image.
+[ -e /usr/sbin/dhclient ] && \
+ [ -e /etc/dhcp/dhclient.d/chrony.sh ] && \
+ [ -e /etc/NetworkManager/dispatcher.d/11-dhclient -o \
+ -e /usr/lib/NetworkManager/dispatcher.d/11-dhclient ] && \
+ exit 0
+ +
interface=$1 interface=$1
action=$2 action=$2
@@ -17,10 +22,18 @@ dhcp_server_file=$server_dir/$interface.sources chronyc=/usr/bin/chronyc
default_server_options=iburst
-server_dir=/var/run/chrony-dhcp
+server_dir=/run/chrony-dhcp
dhcp_server_file=$server_dir/$interface.sources
# DHCP4_NTP_SERVERS is passed from DHCP options by NetworkManager. # DHCP4_NTP_SERVERS is passed from DHCP options by NetworkManager.
nm_dhcp_servers=$DHCP4_NTP_SERVERS nm_dhcp_servers=$DHCP4_NTP_SERVERS
@ -48,17 +60,5 @@ index 6ea4c37..878e72f 100644
$chronyc reload sources > /dev/null 2>&1 || : $chronyc reload sources > /dev/null 2>&1 || :
} }
-- --
2.26.2 2.29.2
diff -up chrony-4.0-pre3/examples/chrony.nm-dispatcher.dhcp.nm-dispatcher-dhcp chrony-4.0-pre3/examples/chrony.nm-dispatcher.dhcp
--- chrony-4.0-pre3/examples/chrony.nm-dispatcher.dhcp.nm-dispatcher-dhcp 2020-08-26 09:27:47.076282468 +0200
+++ chrony-4.0-pre3/examples/chrony.nm-dispatcher.dhcp 2020-08-26 09:27:51.847297974 +0200
@@ -16,7 +16,7 @@ action=$2
chronyc=/usr/bin/chronyc
default_server_options=iburst
-server_dir=/var/run/chrony-dhcp
+server_dir=/run/chrony-dhcp
dhcp_server_file=$server_dir/$interface.sources
# DHCP4_NTP_SERVERS is passed from DHCP options by NetworkManager.

View File

@ -63,7 +63,7 @@ md5sum -c <<-EOF | (! grep -v 'OK$')
2d01b94bc1a7b7fb70cbee831488d121 examples/chrony.conf.example2 2d01b94bc1a7b7fb70cbee831488d121 examples/chrony.conf.example2
96999221eeef476bd49fe97b97503126 examples/chrony.keys.example 96999221eeef476bd49fe97b97503126 examples/chrony.keys.example
6a3178c4670de7de393d9365e2793740 examples/chrony.logrotate 6a3178c4670de7de393d9365e2793740 examples/chrony.logrotate
e051740bb4b21e2e12e6dc63f5195c48 examples/chrony.nm-dispatcher.dhcp 2da011da89727ef009799502d84e7cd0 examples/chrony.nm-dispatcher.dhcp
8f5a98fcb400a482d355b929d04b5518 examples/chrony.nm-dispatcher.onoffline 8f5a98fcb400a482d355b929d04b5518 examples/chrony.nm-dispatcher.onoffline
32c34c995c59fd1c3ad1616d063ae4a0 examples/chronyd.service 32c34c995c59fd1c3ad1616d063ae4a0 examples/chronyd.service
EOF EOF