components/openstack/nova/files/nova-upgrade
branchs11-update
changeset 4207 787ed839f409
parent 4072 db0cec748ec0
child 4314 96c1b7e2e45c
equal deleted inserted replaced
4203:e5795ec8c7a3 4207:787ed839f409
   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