summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sprygada <psprygada@ansible.com>2017-01-11 07:51:00 -0500
committerPeter Sprygada <psprygada@ansible.com>2017-01-11 07:51:00 -0500
commita3cc24efb2438e920dcf0d5934a5bb85606ef9d1 (patch)
tree3656f5d4ead6d0dba78369841333191083fc53e1
parent0a0013e1eba5f34925d03f73f659c6b6056660be (diff)
downloadansible-a3cc24efb2438e920dcf0d5934a5bb85606ef9d1.tar.gz
adds get_block_config() method to NetworkConfig
new method that will return the config block string for the specified config path
-rw-r--r--lib/ansible/module_utils/netcfg.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/netcfg.py b/lib/ansible/module_utils/netcfg.py
index 731492ef11..a895e5620d 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()