cc-4227: updated install scripts for upgrade
This commit is contained in:
parent
abeef43a5b
commit
6c1e822b6a
4 changed files with 22 additions and 16 deletions
|
@ -7,22 +7,21 @@ upgrades_config = {
|
|||
'/etc/airtime/api_client.cfg' : '../api_clients/api_client.cfg',
|
||||
}
|
||||
|
||||
def upgrade(upgrade_data):
|
||||
def upgrade(source, destination):
|
||||
"""
|
||||
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.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.iteritems():
|
||||
if key not in cfg_dest: cfg_dest[key] = val
|
||||
cfg_dest.write()
|
||||
except Exception:
|
||||
print("Error upgrading")
|
||||
print( traceback.format_exc() )
|
||||
if not os.path.exists(source):
|
||||
print("Cannot upgrade '%s'. Skipping this file" % source)
|
||||
return
|
||||
try:
|
||||
cfg_source, cfg_dest = ConfigObj(source), ConfigObj(destination)
|
||||
for key, val in cfg_source.iteritems():
|
||||
if key not in cfg_dest: cfg_dest[key] = val
|
||||
cfg_dest.write()
|
||||
except Exception:
|
||||
print("Error upgrading")
|
||||
print( traceback.format_exc() )
|
||||
|
||||
if __name__ == "__main__": upgrade(upgrades_config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue