added one more error value to the enum
"ping" relies on realmd, which is part of the minimal layer.
For now not considering it coming from the snap.
The package is not staged at this point.
We got multiple bug reports in the past stating that the installer is
not honoring some part of the apt settings; either supplied by means of
autoinstall (e.g., pinning) or via the subiquity UI (e.g., proxy).
What happens under the hood is that curtin overwrites the APT settings
as part of the curthooks stage ; effectively discarding earlier settings
applied in the apt-config stage.
Curtin does so because we pass debconf_selections directives to
curthooks. In the past, curtin used to handle debconf_selections
separately but nowadays it considers that they are part of the APT
config. As a result, it decides to run apt-config again (but with a
close to empty configuration) as part of the curthooks stage.
We now pass debconf_selections as part of the apt-config stage. This
should hint curtin not to run apt-config again as part of curthooks.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Raising from the POST /mirror handler makes it difficult for the client
to distinguish an internal error from the lack of usable mirror.
We now return an enumeration with the following possible values:
* ok
* no-usable-mirror
It is up to the client to either:
1. adjust the network settings and retry
2. give up on the install
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
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>