Add unpacking stage to AppMgr installation
This commit is contained in:
parent
0f4c2756ec
commit
5ba5461a80
@ -32,7 +32,7 @@ class ActionItem:
|
|||||||
|
|
||||||
class InstallItem:
|
class InstallItem:
|
||||||
def __init__(self, total):
|
def __init__(self, total):
|
||||||
# Stage 0 = download, 1 = deps install, 2 = app install
|
# Stage 0 = download, 1 = unpack, 2 = deps install, 3 = app install
|
||||||
self.stage = 0
|
self.stage = 0
|
||||||
self.total = total
|
self.total = total
|
||||||
self.downloaded = 0
|
self.downloaded = 0
|
||||||
@ -108,9 +108,13 @@ class AppMgr:
|
|||||||
for dep in deps:
|
for dep in deps:
|
||||||
self.download_package(dep, item.data)
|
self.download_package(dep, item.data)
|
||||||
for dep in deps:
|
for dep in deps:
|
||||||
item.data.stage = 2 if dep == deps[-1] else 1
|
item.data.stage = 1
|
||||||
|
# Purge old data before unpacking to clean previous failed installation
|
||||||
|
self.purge_package()
|
||||||
self.unpack_package(dep)
|
self.unpack_package(dep)
|
||||||
# Run uninstall script before installation to purge previous failed installation
|
for deps in deps:
|
||||||
|
item.data.stage = 3 if dep == deps[-1] else 2
|
||||||
|
# Run uninstall script before installation to clean previous failed installation
|
||||||
self.run_uninstall_script(dep)
|
self.run_uninstall_script(dep)
|
||||||
self.register_package(dep)
|
self.register_package(dep)
|
||||||
self.run_install_script(dep)
|
self.run_install_script(dep)
|
||||||
@ -143,7 +147,9 @@ class AppMgr:
|
|||||||
|
|
||||||
def purge_package(self, name):
|
def purge_package(self, name):
|
||||||
# Removes package and shared data from filesystem
|
# Removes package and shared data from filesystem
|
||||||
shutil.rmtree(os.path.join(LXC_ROOT, self.conf['packages'][name]['lxcpath']))
|
lxc_dir = os.path.join(LXC_ROOT, self.conf['packages'][name]['lxcpath'])
|
||||||
|
if os.path.exists(lxc_dir):
|
||||||
|
shutil.rmtree(lxc_dir)
|
||||||
srv_dir = os.path.join('/srv/', name)
|
srv_dir = os.path.join('/srv/', name)
|
||||||
if os.path.exists(srv_dir):
|
if os.path.exists(srv_dir):
|
||||||
shutil.rmtree(srv_dir)
|
shutil.rmtree(srv_dir)
|
||||||
|
@ -184,6 +184,8 @@ class WSGIApp(object):
|
|||||||
if item.data.stage == 0:
|
if item.data.stage == 0:
|
||||||
status = 'Stahuje se ({} %)'.format(item.data)
|
status = 'Stahuje se ({} %)'.format(item.data)
|
||||||
elif item.data.stage == 1:
|
elif item.data.stage == 1:
|
||||||
|
status = 'Rozbaluje se'
|
||||||
|
elif item.data.stage == 2:
|
||||||
status = 'Instalují se závislosti'
|
status = 'Instalují se závislosti'
|
||||||
else:
|
else:
|
||||||
status = 'Instaluje se'
|
status = 'Instaluje se'
|
||||||
|
Loading…
Reference in New Issue
Block a user