Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop caching of api_version and pine_endpoint on balena.cfg #375

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions balena/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def __read_settings(self):
config_data = {}
options = config_reader.options(self.CONFIG_SECTION)
for option in options:
# Always use the default supported SDK version and pine endpoint
# Unless it was explicetely defined differently (in short, do not cache this )
if option == "api_version":
config_data[option] = self.__base_settings[option]
continue
try:
config_data[option] = config_reader.get(self.CONFIG_SECTION, option)
if config_data[option] == "true":
Expand All @@ -172,6 +177,8 @@ def __read_settings(self):
config_data[option] = False
except Exception:
config_data[option] = None
# Ensure pine endpoint matches the final decided api_version
config_data["pine_endpoint"] = f"https://api.{config_data['balena_host']}/{config_data['api_version']}/"
self._setting = config_data

def has(self, key: str) -> bool:
Expand Down
Loading