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
refactor how mirror data is handled #626
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple questions and comments.
subiquity/models/mirror.py
Outdated
|
||
|
||
def get_default_mirror(): | ||
return get_mirror(DEFAULT, "primary", get_architecture()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we move the get_mirror() call to the object initialization so we can cache it? It won't change during the lifetime of the install so we can save some execs and overhead if we keep it around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, we recently made use of python3's lru_cache() in cloud-init
from functools import lru_cache()
@lru_cache()
def get_default_mirror()
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tweaked a bit, see what you think now.
This is prep work for allowing autoinstalls to specify a complete apt config.
c0e5ce3
to
52fc18b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. I'm fine with things; I've some suggestions if you're interested.
subiquity/models/mirror.py
Outdated
], | ||
} | ||
|
||
ARCHITECTURE = get_architecture() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this create a side-effect of executing dpkg if something imports this module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, nothing outside of this module uses DEFAULT_MIRROR or ARCHITECTURE and the API being used are the method son the MirrorModel itself, could we move these values to the class itself? then they can be properties that are cached after initialization in init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that makes more sense, thanks.
417ca73
to
2c1d350
Compare
This is prep work for allowing autoinstalls to specify a complete apt
config.