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