-
Notifications
You must be signed in to change notification settings - Fork 155
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
source: allow to specify source ID in autoinstall config #1375
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.
Thank you, both for addressing the immediate need for source selection and the general schema validation improvements. All of this is great.
I think we should make the needed schema changes to allow foo: null
for all toplevel keys except version. There is a small risk that someone has used that to explicitly say "give me the defaults for this section" rather than relying on obtaining that by omission, and proxy serves as a sort of precedent for that.
If there are other cases like version where that doesn't make sense, let's discuss.
Yes, I see your point but I don't think this is sane to let the users think they can pass For the following controllers, we set a custom value that gets used when said section is absent:
but if the section is set to def load_autoinstall_data(self, data):
log.debug("data is %s", data)
os.environ["LANG"] = data with no
with
(and also it fails later on):
I would prefer rejecting |
I created #1377 to address the issue with the top-level sections potentially being null. |
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.
LGTM.
A runtests update to check for this value would be nice.
The source autoinstall section now supports the "id" field where the user can supply the ID of a source, e.g., "ubuntu-server" or "ubuntu-server-minimal". If the field is not supplied, the installation will use the source declared default: true (if any) in the source catalog. Otherwise, it the first source declared will be used. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
In the source autoinstall section, the search_drivers key was marked required. This made sense at the time when it was the only supported key. However, now that we also support the source ID, we don't want to force the user to supply search_drivers as well. Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Good point, I added one test. |
This PR brings support for the following data in autoinstall configuration:
One of the particularity of the source controller is that it does not have access to the source catalog by the time the autoinstall data is loaded. Therefore, we have to store the data first and do the magic later in
apply_autoinstall_config
.The
search_drivers
key used to be required as part of thesource
section. This made sense (I wonder, really?) whensearch_drivers
was the only key supported (what's the point of declaring the section if we're not setting any value?) but it should be made optional now since the user may want to specify the source ID without bothering with drivers stuff.moved to https://github.com//pull/1377
Also, I realized that the top level autoinstall sections accepted the `null` value although such a configuration should have been rejected according to the JSON schema:This happened because the JSON validation was skipped when a section was set to
null
. The goal was to allow the controllers to setautoinstall_default
toNone
(which is a sensible thing to do).However, instead of skipping validation when the section resolves to
None
, the better thing to do is to skip the validation whenautoinstall_default
is effectively used.If we want to accept
null
for a given section, we can by adding"null"
to the list of accepted types:the
proxy
section is an example.