cc-4227: fixed small bugs in upgrade script and finished testing
This commit is contained in:
parent
b4c014dbcc
commit
abeef43a5b
2 changed files with 49 additions and 3 deletions
|
@ -12,13 +12,13 @@ def upgrade(upgrade_data):
|
|||
Must be ran as sudo. will do upgrade of configuration files by filling in
|
||||
missing values according to upgrade_data
|
||||
"""
|
||||
for source, destination in upgrade_data:
|
||||
for source, destination in upgrade_data.iteritems():
|
||||
if not os.path.exists(source):
|
||||
print("Cannot upgrade '%s'. Skipping this file" % source)
|
||||
continue
|
||||
try:
|
||||
cfg_source, cfg_dest = ConfigObj(source), ConfigObj(destination)
|
||||
for key, val in cfg_source:
|
||||
for key, val in cfg_source.iteritems():
|
||||
if key not in cfg_dest: cfg_dest[key] = val
|
||||
cfg_dest.write()
|
||||
except Exception:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue