install update before restart
This commit is contained in:
parent
1efe02c87c
commit
e654d391fd
1 changed files with 6 additions and 10 deletions
|
@ -81,6 +81,7 @@ def get_latest_release():
|
|||
release_data = get(settings.server.get('release_url'))
|
||||
release = json.loads(release_data.decode('utf-8'))
|
||||
if verify(release):
|
||||
ox.makedirs(settings.updates_path)
|
||||
with open(os.path.join(settings.updates_path, 'release.json'), 'wb') as fd:
|
||||
fd.write(release_data)
|
||||
return release
|
||||
|
@ -111,7 +112,7 @@ def download():
|
|||
return True
|
||||
return True
|
||||
|
||||
def install():
|
||||
def install(stop=True):
|
||||
if not os.path.exists(os.path.join(settings.updates_path, 'release.json')):
|
||||
return True
|
||||
if not os.path.exists(os.path.join(settings.config_path, 'release.json')):
|
||||
|
@ -145,11 +146,9 @@ def install():
|
|||
os.unlink(module_tar)
|
||||
return False
|
||||
shutil.copy(os.path.join(settings.updates_path, 'release.json'), os.path.join(settings.config_path, 'release.json'))
|
||||
for cmd in [
|
||||
['./ctl', 'stop'],
|
||||
['./ctl', 'postupdate', '-o', old_version, '-n', new_version]
|
||||
]:
|
||||
subprocess.call(cmd)
|
||||
if stop:
|
||||
subprocess.call(['./ctl', 'stop'])
|
||||
subprocess.call(['./ctl', 'postupdate', '-o', old_version, '-n', new_version])
|
||||
upgrade_app()
|
||||
return True
|
||||
return True
|
||||
|
@ -262,11 +261,8 @@ class Update(Thread):
|
|||
time.sleep(10)
|
||||
self.status('Downloading new version...')
|
||||
self.status('Installing new version...')
|
||||
# install right now calls stop!
|
||||
'''
|
||||
if not install():
|
||||
if not install(False):
|
||||
self.status('Installation failed...')
|
||||
'''
|
||||
restart_oml()
|
||||
|
||||
def update_database(self):
|
||||
|
|
Loading…
Reference in a new issue