Skip to content

Commit 00c51b7

Browse files
authored
Merge pull request #9 from OS2borgerPC/8-auto-udate-client-if-no-desired-version-i-specified
if config-param is not set, enterpret as auto-update
2 parents 21374ea + 31d54f9 commit 00c51b7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

bin/jobmanager

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ UPDATE_FREQUENCY = 200 # Higher values: Check for updates less often
1919

2020
# Get the current and desired client versions
2121
CURRENT_CLIENT_VERSION = pkg_resources.get_distribution("os2borgerpc_client").version
22-
DESIRED_CLIENT_VERSION = get_config("os2borgerpc_client_version")
22+
DESIRED_CLIENT_VERSION = None # Default to None
2323

24-
# Automatically fetch the newest version if configured
25-
if DESIRED_CLIENT_VERSION.lower() == "auto" and random.randint(1, UPDATE_FREQUENCY) == 1:
26-
DESIRED_CLIENT_VERSION = get_newest_client_version()
24+
try:
25+
DESIRED_CLIENT_VERSION = get_config("os2borgerpc_client_version")
26+
except KeyError:
27+
# If not set, enable periodic: Automatically fetch the newest version if the key is missing
28+
if random.randint(1, UPDATE_FREQUENCY) == 1:
29+
DESIRED_CLIENT_VERSION = get_newest_client_version()
2730

2831
# Check for updates if a desired version is specified
29-
if DESIRED_CLIENT_VERSION and DESIRED_CLIENT_VERSION.lower() != "auto":
32+
if DESIRED_CLIENT_VERSION:
3033
stripped_version = DESIRED_CLIENT_VERSION.lstrip("v")
3134
if semver.compare(stripped_version, CURRENT_CLIENT_VERSION) == 1:
3235
print(f"Installed client version: {CURRENT_CLIENT_VERSION}")

0 commit comments

Comments
 (0)