Fix for unmanaged dhclients left after cloud-init
When cloud-init generated file
/etc/network/interfaces.d/50-cloud-init.cfg
with interfaces configured to use dhcp is deleted all dhclients remain
running in unmanaged state. It means that this dhclients will not be
kiled on next ifdown of the interface.
Restart of networking kills all running dhclients and launches new ones
if there are any interfaces configured as dhcp in
/etc/network/interfaces
Prod related: #PROD-28694 (PROD:28694)
Change-Id: I3108121db0e161ecc206682941e3ae7a175bbcaf
diff --git a/linux/network/interface.sls b/linux/network/interface.sls
index 5d7e22b..38b486e 100644
--- a/linux/network/interface.sls
+++ b/linux/network/interface.sls
@@ -60,6 +60,12 @@
file.absent:
- name: /etc/network/interfaces.d/50-cloud-init.cfg
+networking:
+ service.running:
+ - enable: True
+ - watch:
+ - file: remove_cloud_init_file
+
{%- endif %}
{%- for interface_name, interface in network.interface.items() %}