From a3cc24efb2438e920dcf0d5934a5bb85606ef9d1 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Wed, 11 Jan 2017 07:51:00 -0500 Subject: [PATCH] adds get_block_config() method to NetworkConfig new method that will return the config block string for the specified config path --- lib/ansible/module_utils/netcfg.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/ansible/module_utils/netcfg.py b/lib/ansible/module_utils/netcfg.py index 731492ef112..a895e5620da 100644 --- a/lib/ansible/module_utils/netcfg.py +++ b/lib/ansible/module_utils/netcfg.py @@ -224,6 +224,10 @@ class NetworkConfig(object): raise ValueError('path does not exist in config') return self._expand_block(obj) + def get_block_config(self, path): + block = self.get_block(path) + return dumps(block, 'config') + def _expand_block(self, configobj, S=None): if S is None: S = list()