mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-09 06:24:15 +02:00
[fix][web] not able to upgrade the environment's NodeJS version
This commit is contained in:
@@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
### Fixes
|
### Fixes
|
||||||
- Web:
|
- Web:
|
||||||
- not able to launch applications for the root user
|
- not able to launch applications for the root user
|
||||||
|
- not able to upgrade the environment's NodeJS version
|
||||||
- handling internet timeout errors
|
- handling internet timeout errors
|
||||||
- minor fixes
|
- minor fixes
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import tarfile
|
import tarfile
|
||||||
|
import traceback
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
@@ -58,7 +59,21 @@ class EnvironmentUpdater:
|
|||||||
|
|
||||||
extracted_file = '{}/{}'.format(ENV_PATH, tf.getnames()[0])
|
extracted_file = '{}/{}'.format(ENV_PATH, tf.getnames()[0])
|
||||||
|
|
||||||
os.rename(extracted_file, NODE_DIR_PATH)
|
if os.path.exists(NODE_DIR_PATH):
|
||||||
|
self.logger.info("Removing old NodeJS version installation dir -> {}".format(NODE_DIR_PATH))
|
||||||
|
try:
|
||||||
|
shutil.rmtree(NODE_DIR_PATH)
|
||||||
|
except:
|
||||||
|
self.logger.error("Could not delete old NodeJS version dir -> {}".format(NODE_DIR_PATH))
|
||||||
|
traceback.print_exc()
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
os.rename(extracted_file, NODE_DIR_PATH)
|
||||||
|
except:
|
||||||
|
self.logger.error("Could not rename the NodeJS version file {} as {}".format(extracted_file, NODE_DIR_PATH))
|
||||||
|
traceback.print_exc()
|
||||||
|
return False
|
||||||
|
|
||||||
if os.path.exists(NODE_MODULES_PATH):
|
if os.path.exists(NODE_MODULES_PATH):
|
||||||
self.logger.info('Deleting {}'.format(NODE_MODULES_PATH))
|
self.logger.info('Deleting {}'.format(NODE_MODULES_PATH))
|
||||||
@@ -71,6 +86,7 @@ class EnvironmentUpdater:
|
|||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
self.logger.error('Could not extract {}'.format(tarf_path))
|
self.logger.error('Could not extract {}'.format(tarf_path))
|
||||||
|
traceback.print_exc()
|
||||||
return False
|
return False
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(tarf_path):
|
if os.path.exists(tarf_path):
|
||||||
|
|||||||
Reference in New Issue
Block a user