mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-12 17:07:22 +01:00
feat: Handle nonexistent binary.
This patches the version component to return a version of 0.0.0 if it fails to detect a version. This allows the update script to install the binary if it does not already exist or is corrupted.
This commit is contained in:
@@ -35,9 +35,13 @@ class Version:
|
|||||||
currentVersion = self.getVersionFromFile()
|
currentVersion = self.getVersionFromFile()
|
||||||
except:
|
except:
|
||||||
# Get the version via the web api if the file does fail
|
# Get the version via the web api if the file does fail
|
||||||
currentVersion = requests.get(self.gtSite).json()['version']
|
try:
|
||||||
if currentVersion.status_code != 200:
|
currentVersion = requests.get(self.gtSite).json()['version']
|
||||||
currentVersion = self.getVersionFromFile()
|
if currentVersion.status_code != 200:
|
||||||
|
raise RuntimeError("Could not download version.")
|
||||||
|
except:
|
||||||
|
# To allow installation, return a default version of "0.0.0".
|
||||||
|
currentVersion = "0.0.0"
|
||||||
finally:
|
finally:
|
||||||
logging.info('Version: current_version = %s', currentVersion)
|
logging.info('Version: current_version = %s', currentVersion)
|
||||||
return currentVersion
|
return currentVersion
|
||||||
|
|||||||
Reference in New Issue
Block a user