From 70c235d30aee3a401414f622b3de4f09f4b3d180 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Thu, 22 Jan 2015 11:33:38 +0000 Subject: Move noop flag to provider base-class Moving this flag makes it easier to implement additional functions which work differently depending on noop mode being set, vs passing it into every function like apply() Change-Id: I796792aece3e40322523e910a3b87f7ab9a451dd --- os_net_config/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'os_net_config/__init__.py') diff --git a/os_net_config/__init__.py b/os_net_config/__init__.py index 484c1e4..3b01b71 100644 --- a/os_net_config/__init__.py +++ b/os_net_config/__init__.py @@ -24,6 +24,9 @@ class NotImplemented(Exception): class NetConfig(object): """Configure network interfaces using the ifcfg format.""" + def __init__(self, noop=False): + self.noop = noop + def add_object(self, obj): """Convenience method to add any type of object to the network config. See objects.py. @@ -71,10 +74,9 @@ class NetConfig(object): """ raise NotImplemented("add_bond is not implemented.") - def apply(self, noop=False, cleanup=False): + def apply(self, cleanup=False): """Apply the network configuration. - :param noop: A boolean which indicates whether this is a no-op. :param cleanup: A boolean which indicates whether any undefined (existing but not present in the object model) interfaces should be disabled and deleted. -- cgit 1.2.3-korg