#4 Move the NetworkManager dispatcher script out of /etc
Closed 2 months ago by larsks. Opened 2 months ago by lkundrak.
rpms/ lkundrak/cloud-init lr/nm-dispatcher-dir  into  master

@@ -0,0 +1,60 @@ 

+ From bb1b5831acb49976a088433390d44e1dcb9f2fb2 Mon Sep 17 00:00:00 2001

+ From: Lubomir Rintel <lkundrak@v3.sk>

+ Date: Thu, 22 Aug 2019 15:52:42 +0200

+ Subject: [PATCH] Move the NetworkManager dispatcher script out of /etc

+ 

+ It's not user configuration and shouldn't ever have been there. Except for that

+ it used to be the only location NetworkManager looked into. With NetworkManager

+ 1.20 that is no longer the case and the dispatcher scripts can be moved to

+ /usr/lib.

+ ---

+  doc/rtd/topics/datasources/azure.rst | 2 +-

+  packages/redhat/cloud-init.spec.in   | 2 +-

+  setup.py                             | 4 ++--

+  3 files changed, 4 insertions(+), 4 deletions(-)

+ 

+ diff --git a/doc/rtd/topics/datasources/azure.rst b/doc/rtd/topics/datasources/azure.rst

+ index b41cddd9..2156a3c4 100644

+ --- a/doc/rtd/topics/datasources/azure.rst

+ +++ b/doc/rtd/topics/datasources/azure.rst

+ @@ -37,7 +37,7 @@ To find the endpoint, we now leverage the dhcp client's ability to log its

+  known values on exit.  The endpoint server is special DHCP option 245.

+  Depending on your networking stack, this can be done

+  by calling a script in /etc/dhcp/dhclient-exit-hooks or a file in

+ -/etc/NetworkManager/dispatcher.d.  Both of these call a sub-command

+ +/usr/lib/NetworkManager/dispatcher.d.  Both of these call a sub-command

+  'dhclient_hook' of cloud-init itself. This sub-command will write the client

+  information in json format to /run/cloud-init/dhclient.hook/<interface>.json.

+  

+ diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in

+ index 057a5784..a4ec3dbe 100644

+ --- a/packages/redhat/cloud-init.spec.in

+ +++ b/packages/redhat/cloud-init.spec.in

+ @@ -186,7 +186,7 @@ fi

+  %attr(0755, root, root) %{_initddir}/cloud-init

+  %endif

+  

+ -%{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager

+ +%{_prefix}/lib/NetworkManager/dispatcher.d/hook-network-manager

+  %{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient

+  

+  # Program binaries

+ diff --git a/setup.py b/setup.py

+ index fcaf26ff..cc25ed8e 100755

+ --- a/setup.py

+ +++ b/setup.py

+ @@ -261,9 +261,9 @@ data_files = [

+  ]

+  if os.uname()[0] != 'FreeBSD':

+      data_files.extend([

+ -        (ETC + '/NetworkManager/dispatcher.d/',

+ -         ['tools/hook-network-manager']),

+          (ETC + '/dhcp/dhclient-exit-hooks.d/', ['tools/hook-dhclient']),

+ +        (USR + '/lib/NetworkManager/dispatcher.d/',

+ +         ['tools/hook-network-manager']),

+          (LIB + '/udev/rules.d', [f for f in glob('udev/*.rules')])

+      ])

+  # Use a subclass for install that handles

+ -- 

+ 2.23.0

+ 

file modified
+11 -2

@@ -1,6 +1,6 @@ 

  Name:           cloud-init

  Version:        17.1

- Release:        12%{?dist}

+ Release:        13%{?dist}

  Summary:        Cloud instance init scripts

  License:        ASL 2.0 or GPLv3

  URL:            http://launchpad.net/cloud-init

@@ -29,6 +29,9 @@ 

  # platform.dist has been removed in Pyton 3.8.

  Patch6:         cloud-init-17.1-deprecated_platform_dist.patch

  

+ # Move the NetworkManager dispatcher script out of /etc

+ Patch7:         cloud-init-17.1-nm_dispatcher_dir.patch

+ 

  BuildArch:      noarch

  

  BuildRequires:  pkgconfig(systemd)

@@ -83,6 +86,9 @@ 

  

  %{?systemd_requires}

  

+ # Old NetworkManager expects the dispatcher scripts in a different place

+ Conflicts:      NetworkManager < 1.20

+ 

  

  %description

  Cloud-init is a set of init scripts for cloud instances.  Cloud instances

@@ -146,7 +152,7 @@ 

  %config(noreplace) %{_sysconfdir}/cloud/templates/*

  %dir               %{_sysconfdir}/rsyslog.d

  %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf

- %{_sysconfdir}/NetworkManager/dispatcher.d/hook-network-manager

+ %{_prefix}/lib/NetworkManager

  %{_sysconfdir}/dhcp/dhclient-exit-hooks.d/hook-dhclient

  /lib/udev/rules.d/66-azure-ephemeral.rules

  %{_unitdir}/cloud-config.service

@@ -165,6 +171,9 @@ 

  

  

  %changelog

+ * Thu Aug 22 2019 Lubomir Rintel <lkundrak@v3.sk> - 17.1-13

+ - Move the NetworkManager dispatcher script out of /etc

+ 

  * Sun Aug 18 2019 Miro HronĨok <mhroncok@redhat.com> - 17.1-12

  - Rebuilt for Python 3.8

  

It's not user configuration and shouldn't ever have been there. Except for that
it used to be the only location NetworkManager looked into. With NetworkManager
1.20 that is no longer the case and the dispatcher scripts can be moved to
/usr/lib.

Not submitted upstream, because I have no idea how to.

cloud-init provides instructions on how to make upstream contributions at https://cloudinit.readthedocs.io/en/latest/topics/hacking.html.

Yes. And they want my phone number, home address and copyright. It is not necessary as my patch is trivial and thus, I believe, not copyrightable.

I'm not going to give them my address because I'm afraid they'll send me Ubuntu.

If my patch is not good enough for upstream, please consider this a bug report and move the dispatcher script to the proper place without it. Sorry for the inconvenience.

Sorry, you said you had no idea how to submit contributions upstream, and I was just providing a pointer. Upstream policy is completely outside of our control.

Pull-Request has been closed by larsks

2 months ago