We used to rely on a version key under apt autoinstall section to
specify if we want the old implementation (i.e., a single candidate
primary mirror) or the new implementation (i.e., multiple primary mirror
candidates).
Instead, we now introduce the apt->mirror-selection autoinstall section,
and move the primary section under it.
If the primary section if under apt, we want the old implementation.
If the primary section is under apt->mirror-selection, we want the new
implementation.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
create_task has the following note:
Important: Save a reference to the result of this function, to avoid a
task disappearing mid-execution.
Convert existing usage of create_task to run_bg_task, if that
create_task is not actually storing the result.
Running ssh-import-id as part of the CI has limitations. First it
requires that we have access to the Internet. Second, it is affected by
github and launchpad service disruptions and or rate limiting policies.
Make sure we don't call ssh-import-id as part of the CI. Instead use a
username that is configured to produce fake successful key imports.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
We now have 3 different dry-run strategies for ssh key imports:
* success: fake a successful key import
* failure: fake a failed key import
* run-on-host: actually run ssh-import-id
Through a dry-run-config file, we can choose which strategy applies
based on the username.
By default, the policy is as follows:
* username 'heracles' uses the fake successful key import
* username 'sisyphus' uses the fake failed key import
* any other username runs ssh-import-id
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
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.