From 6dde259fa5b8378af6100e5936451b0bec80d0c2 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 11 Nov 2013 06:33:57 +0000 Subject: [PATCH] Under Python 2.6, curly braces in strings to `.format()` MUST be indexed. --- salt/modules/kmod.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/salt/modules/kmod.py b/salt/modules/kmod.py index 3091105d8e..c729af370e 100644 --- a/salt/modules/kmod.py +++ b/salt/modules/kmod.py @@ -88,7 +88,9 @@ def _set_persistent_module(mod): return set() escape_mod = re.escape(mod) ## If module is commented only uncomment it - if __salt__['file.contains_regex_multiline'](conf, "^#[\t ]*{}[\t ]*$".format(escape_mod)): + if __salt__['file.contains_regex_multiline'](conf, + '^#[\t ]*{0}[\t ]*$'.format( + escape_mod)): __salt__['file.uncomment'](conf, escape_mod) else: __salt__['file.append'](conf, mod) @@ -106,9 +108,9 @@ def _remove_persistent_module(mod, comment): return set() escape_mod = re.escape(mod) if comment: - __salt__['file.comment'](conf, "^[\t ]*{}[\t ]?".format(escape_mod)) + __salt__['file.comment'](conf, '^[\t ]*{0}[\t ]?'.format(escape_mod)) else: - __salt__['file.sed'](conf, "^[\t ]*{}[\t ]?".format(escape_mod), '') + __salt__['file.sed'](conf, '^[\t ]*{0}[\t ]?'.format(escape_mod), '') return set([mod_name])