Handle an empty value in a name/value pair in config_replace_variables()
This would blow up if you tried to append a value to an entry that looked like:
NAME= rob
>From a210407b62328a464358338e8eb46db9e69e5d6b Mon Sep 17 00:00:00 2001 From: Rob Crittenden <[email protected]> Date: Fri, 14 Oct 2011 09:36:26 -0400 Subject: [PATCH] Handle an empty value in a name/value pair in config_replace_variables() This would blow up if you tried to append a value to an entry that looked like: NAME= https://fedorahosted.org/freeipa/ticket/1983 --- ipapython/ipautil.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py index b002594..75e8e6f 100644 --- a/ipapython/ipautil.py +++ b/ipapython/ipautil.py @@ -1235,7 +1235,9 @@ $)''', re.VERBOSE) old_values[option] = value if appendvars and option in appendvars: # append new value unless it is already existing in the original one - if value.find(appendvars[option]) == -1: + if not value: + new_line = u"%s=%s\n" % (option, appendvars[option]) + elif value.find(appendvars[option]) == -1: new_line = u"%s=%s %s\n" % (option, value, appendvars[option]) old_values[option] = value new_config.write(new_line) -- 1.7.6
_______________________________________________ Freeipa-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/freeipa-devel
