mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Put try/except around creation
This commit is contained in:
parent
a07eb58db7
commit
2becb657ca
@ -226,24 +226,29 @@ class ImportHelpers:
|
|||||||
download_thread.start()
|
download_thread.start()
|
||||||
|
|
||||||
def download_threaded_bedrock_server(self, path, new_id):
|
def download_threaded_bedrock_server(self, path, new_id):
|
||||||
|
|
||||||
# downloads zip from remote url
|
# downloads zip from remote url
|
||||||
bedrock_url = Helpers.get_latest_bedrock_url()
|
try:
|
||||||
if bedrock_url.lower().startswith("https"):
|
bedrock_url = Helpers.get_latest_bedrock_url()
|
||||||
urllib.request.urlretrieve(
|
if bedrock_url.lower().startswith("https"):
|
||||||
bedrock_url,
|
urllib.request.urlretrieve(
|
||||||
os.path.join(path, "bedrock_server.zip"),
|
bedrock_url,
|
||||||
)
|
os.path.join(path, "bedrock_server.zip"),
|
||||||
|
)
|
||||||
|
|
||||||
unzip_path = os.path.join(path, "bedrock_server.zip")
|
unzip_path = os.path.join(path, "bedrock_server.zip")
|
||||||
unzip_path = self.helper.wtol_path(unzip_path)
|
unzip_path = self.helper.wtol_path(unzip_path)
|
||||||
# unzips archive that was downloaded.
|
# unzips archive that was downloaded.
|
||||||
FileHelpers.unzip_file(unzip_path)
|
FileHelpers.unzip_file(unzip_path)
|
||||||
# adjusts permissions for execution if os is not windows
|
# adjusts permissions for execution if os is not windows
|
||||||
if not self.helper.is_os_windows():
|
if not self.helper.is_os_windows():
|
||||||
os.chmod(os.path.join(path, "bedrock_server"), 0o0744)
|
os.chmod(os.path.join(path, "bedrock_server"), 0o0744)
|
||||||
|
|
||||||
|
# we'll delete the zip we downloaded now
|
||||||
|
os.remove(os.path.join(path, "bedrock_server.zip"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.critical(f"Failed to download bedrock executable for update \n{e}")
|
||||||
|
|
||||||
# we'll delete the zip we downloaded now
|
|
||||||
os.remove(os.path.join(path, "bedrock_server.zip"))
|
|
||||||
ServersController.finish_import(new_id)
|
ServersController.finish_import(new_id)
|
||||||
server_users = PermissionsServers.get_server_user_list(new_id)
|
server_users = PermissionsServers.get_server_user_list(new_id)
|
||||||
for user in server_users:
|
for user in server_users:
|
||||||
|
Loading…
Reference in New Issue
Block a user