When offline, it is possible when requesting the final configuration
that the mirror model does not have an elected primary mirror.
This happens every time in an automated offline install.
Make sure that we return something sensible instead of raising an
exception.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Models that participate in building the apt configuration (i.e.,
currently proxy & mirror) now have the same method signature
get_apt_config having "final" as a parameter.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The mirror model has the notion of primary candidates, staged primary
candidate and elected primary candidate. This is purely specific to the
mirror model and does not necessarily make sense from the outside.
In code that does not specifically need to know implmentation details of
the mirror model, we now prefer the wording "final configuration" over
"elected configuration".
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
* GET /mirror now returns:
* the URL of all the candidates
* the URL of the candidate staged for testing (if any - otherwise null)
* the URL of the elected candidate (if any - otherwise null)
* POST /mirror can now be invoked in different ways:
* Make fr.archive.ubuntu.com be the elected mirror ; and mark the
mirror model configured:
{"elected": "http://fr.archive.ubuntu.com/ubuntu"}
* Mark us.archive.ubuntu.com as staged for testing.
This replaces POST /mirror/candidate that was recently introduced
(except it does not override model.candidates)
{"staged": "http://us.archive.ubuntu.com/ubuntu"}
* Replace the list of candidates with the new values. Not used on
practice, but can be used for testing / debugging.
{"candidates": ["http://us.archive.ubuntu.com/ubuntu"]}
* Explicit way to trigger the election of a mirror automatically.
If a mirror is elected, the model will be marked configured ;
otherwise an exception is raised. This would be the recommended
option for the desktop installer NOTE: maybe something like
null
A combination of multiple key can also be used.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Country mirrors start with no URI. Make sure we skip those if we don't
receive a geoip query response.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Although it is not recommended, a client can mark the mirror model
configured by way of meta/mark_configured. If this happens, we will now
automatically run mirror testing to find the right candidate.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Clients that do not have a mirror screen can now rely on mirror testing
in a way similar to autoinstall. They can do so by sending a POST
request to /mirror with null in the body.
The call will block and will only return after Subiquity has either:
* found a suitable mirror and elected it (mirror gets marked
configured)
* failed to find a suitable mirror ; a NoUsableMirrorError extception
gets raised.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When Subiquity starts, we no longer assign the elected mirror. This
means that marking the mirror model configured without selecting a
mirror is possible, and will cause trouble during install.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Allows clients to call specific endpoint on demand
as the user inputs data, looking for a smoother UX.
Better wording check_admin_user_name docstring:
- "all the possible errors" is too strong.
Previously unformatted partition creation was blocked, but supplying
None does seem to do the right thing, and we want to support creation of
unformatted partitions. Allow it and add a API test to help document it
as an intended feature.
This patchs makes Subiquity internally support multiple primary
sections. Emphasis on "internally" because we only accept a single
section for autoinstalls. This is a first step into making it possible
to use multiple candidates mirrors.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When the user selects a language, we now attempt to generate the
relevant locale definition. The generation can fail for multiple reasons
(including running as non-root) so a failure is not considered fatal.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
By setting the LANG variable and passing clean_locale=False, the apt-get
command will be translated if the locale definition exists on the
system.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>