equal
deleted
inserted
replaced
164 section_items = default_items |
164 section_items = default_items |
165 |
165 |
166 for key, value in section_items: |
166 for key, value in section_items: |
167 # keep a copy of the old value |
167 # keep a copy of the old value |
168 oldvalue = value |
168 oldvalue = value |
|
169 oldsection = section |
169 |
170 |
170 if mapping is not None: |
171 if mapping is not None: |
171 section, key = update_mapping(section, key, mapping) |
172 section, key = update_mapping(section, key, mapping) |
172 |
173 |
173 if section is None and key is None: |
174 if section is None and key is None: |
194 # Only copy the old value to the new conf file if the entry doesn't |
195 # Only copy the old value to the new conf file if the entry doesn't |
195 # exist or if it contains '%SERVICE' |
196 # exist or if it contains '%SERVICE' |
196 if not new.has_option(section, key) or \ |
197 if not new.has_option(section, key) or \ |
197 '%SERVICE' in new.get(section, key): |
198 '%SERVICE' in new.get(section, key): |
198 new.set(section, key, value) |
199 new.set(section, key, value) |
|
200 section = oldsection |
199 |
201 |
200 # copy the old conf file to a backup |
202 # copy the old conf file to a backup |
201 today = datetime.now().strftime("%Y%m%d%H%M%S") |
203 today = datetime.now().strftime("%Y%m%d%H%M%S") |
202 shutil.copy2(old_file, old_file + '.' + today) |
204 shutil.copy2(old_file, old_file + '.' + today) |
203 |
205 |