equal
deleted
inserted
replaced
219 section_items = default_items |
219 section_items = default_items |
220 |
220 |
221 for key, value in section_items: |
221 for key, value in section_items: |
222 # keep a copy of the old value |
222 # keep a copy of the old value |
223 oldvalue = value |
223 oldvalue = value |
|
224 oldsection = section |
224 |
225 |
225 if mapping is not None: |
226 if mapping is not None: |
226 section, key = update_mapping(section, key, mapping) |
227 section, key = update_mapping(section, key, mapping) |
227 |
228 |
228 if section is None and key is None: |
229 if section is None and key is None: |
249 # Only copy the old value to the new conf file if the entry doesn't |
250 # Only copy the old value to the new conf file if the entry doesn't |
250 # exist or if it contains '%SERVICE' |
251 # exist or if it contains '%SERVICE' |
251 if not new.has_option(section, key) or \ |
252 if not new.has_option(section, key) or \ |
252 '%SERVICE' in new.get(section, key): |
253 '%SERVICE' in new.get(section, key): |
253 new.set(section, key, value) |
254 new.set(section, key, value) |
|
255 section = oldsection |
254 |
256 |
255 # copy the old conf file to a backup |
257 # copy the old conf file to a backup |
256 today = datetime.now().strftime("%Y%m%d%H%M%S") |
258 today = datetime.now().strftime("%Y%m%d%H%M%S") |
257 shutil.copy2(old_file, old_file + '.' + today) |
259 shutil.copy2(old_file, old_file + '.' + today) |
258 |
260 |