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

ngclient: Make updater.config immutable #2471

Open
jku opened this issue Sep 27, 2023 · 0 comments
Open

ngclient: Make updater.config immutable #2471

jku opened this issue Sep 27, 2023 · 0 comments

Comments

@jku
Copy link
Member

jku commented Sep 27, 2023

This comes from #2363 / #2359 : we should make the config somehow immutable once it's been used by Updater. This should be a difficult mistake to make:

updater = Updater(...) 
updater.refresh()
updater.config.offline = True

(the issue is refresh() already used config.offline: the value can't be changed during lifetime of Updater. Likely this makes sense for all config)

I originally suggested reading the updater.config.offline value only once during initialization, but that still makes writing the above code possible. Would be better if it failed linting.

I suppose two possible actions:

  • Updater.config becomes a read only property (or not public at all)
  • Could make UpdaterConfig frozen=True as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant