Fix --noop being ignored for dhclient execution

The stop_dhclient_execution() method calls netconfig.execute
directly from the object, instead of from the instance of
the object. This has the effect that when execute is called,
noop is always set false, even if os-net-config was called
with --noop. This results in a failure or network outage.

This change checks the value of self.noop from within the
provider.apply() method before calling the
stop_dhclient_execution method.

Change-Id: Ie2cc4519d7028dceb3a14bd7711839834db0ebdf
Closes-bug: 1699590
(cherry picked from commit 38e67fcd31)
This commit is contained in:
Dan Sneddon 2017-06-21 15:48:17 -07:00 committed by Emilien Macchi
parent 9e081bf6a3
commit 914635c2a0
1 changed files with 4 additions and 1 deletions

View File

@ -968,7 +968,10 @@ class IfcfgNetConfig(os_net_config.NetConfig):
# If dhclient is running and dhcp not set, stop dhclient
for interface in stop_dhclient_interfaces:
stop_dhclient_process(interface)
logger.debug("Calling stop_dhclient_interfaces() for %s" %
interface)
if not self.noop:
stop_dhclient_process(interface)
for interface in restart_interfaces:
self.ifup(interface)