diff --git a/osc/OscConfigParser.py b/osc/OscConfigParser.py index 90fa94e5..1a738ff2 100644 --- a/osc/OscConfigParser.py +++ b/osc/OscConfigParser.py @@ -168,6 +168,8 @@ class OptionLine(Line): def format(self, line): mo = ConfigParser.ConfigParser.OPTCRE.match(line.strip()) key, val = mo.group('option', 'value') + # escape all occurrences of '%' otherwise string formatting will fail + line = line.replace('%', '%%') self.frmt = line.replace(key.strip(), '%s', 1) pos = val.find(' ;') if pos >= 0: diff --git a/osc/conf.py b/osc/conf.py index eefec2db..c58944ee 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -264,7 +264,7 @@ def write_initial_config(conffile, entries, custom_template = ''): try: try: os.chmod(conffile, 0600) - cp.write(file) + cp.write(file, True) except IOError, e: raise oscerr.OscIOError(e, 'cannot write configfile \'s\'' % conffile) finally: