components/openstack/heat/files/heat-upgrade
branchs11u2-sru
changeset 4217 631d20122b9c
parent 4156 4b1def16fe9b
child 4314 96c1b7e2e45c
equal deleted inserted replaced
4216:27e9e7478812 4217:631d20122b9c
   159             section_items = default_items
   159             section_items = default_items
   160 
   160 
   161         for key, value in section_items:
   161         for key, value in section_items:
   162             # keep a copy of the old value
   162             # keep a copy of the old value
   163             oldvalue = value
   163             oldvalue = value
       
   164             oldsection = section
   164 
   165 
   165             if mapping is not None:
   166             if mapping is not None:
   166                 section, key = update_mapping(section, key, mapping)
   167                 section, key = update_mapping(section, key, mapping)
   167 
   168 
   168                 if section is None and key is None:
   169                 if section is None and key is None:
   189             # Only copy the old value to the new conf file if the entry doesn't
   190             # Only copy the old value to the new conf file if the entry doesn't
   190             # exist or if it contains '%SERVICE'
   191             # exist or if it contains '%SERVICE'
   191             if not new.has_option(section, key) or \
   192             if not new.has_option(section, key) or \
   192                '%SERVICE' in new.get(section, key):
   193                '%SERVICE' in new.get(section, key):
   193                 new.set(section, key, value)
   194                 new.set(section, key, value)
       
   195             section = oldsection
   194 
   196 
   195     # copy the old conf file to a backup
   197     # copy the old conf file to a backup
   196     today = datetime.now().strftime("%Y%m%d%H%M%S")
   198     today = datetime.now().strftime("%Y%m%d%H%M%S")
   197     shutil.copy2(old_file, old_file + '.' + today)
   199     shutil.copy2(old_file, old_file + '.' + today)
   198 
   200