From ab3c5a0a17f4b610db4b57653772a7a2f6cea74f Mon Sep 17 00:00:00 2001 From: Peter Sprygada <psprygada@ansible.com> Date: Fri, 15 Jul 2016 16:13:41 -0400 Subject: [PATCH] minor update to the default comment tokens in netcfg * adds checkout /* and */ as comment delimiters * now raises exception if invalid output keyword value is used --- lib/ansible/module_utils/netcfg.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/netcfg.py b/lib/ansible/module_utils/netcfg.py index 085fe18a64..60a949e394 100644 --- a/lib/ansible/module_utils/netcfg.py +++ b/lib/ansible/module_utils/netcfg.py @@ -26,7 +26,7 @@ import itertools from ansible.module_utils.basic import BOOLEANS_TRUE, BOOLEANS_FALSE from ansible.module_utils.network import to_list -DEFAULT_COMMENT_TOKENS = ['#', '!'] +DEFAULT_COMMENT_TOKENS = ['#', '!', '/*', '*/'] class ConfigLine(object): @@ -119,6 +119,8 @@ def dumps(objects, output='block'): line.extend([p.text for p in obj.parents]) line.append(obj.text) items.append(' '.join(line)) + else: + raise TypeError('unknown value supplied for keyword output') return '\n'.join(items) class NetworkConfig(object):