`realm discover` without a domain name attempts to find one from DHCP.
This attempts to run it from the controller start method.
Only creates the discover task if there is support
Avoids exception on controller start.
Currently only the realm program is executed by the ad controller.
Thus we only check if its accessible.
Clients should call this endpoint prior to showing the AD screen.
If a specific source ID is set via autoinstall but the source controller
is marked interactive, the UI would select the default source (i.e., the
first one on the list) instead of the one matching the ID specified.
This happens because the matching between the ID and the sources loaded
was done in apply_autoinstall_config ; which is only called in
non-interactive scenarios.
By moving this matching in the start coroutine instead, the right source
is also selected when the source controller is interactive.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
parameterized async tests run into cpython bug gh-101486
We use parameterized.expand, which works by creating new functions and
inserting those into the list of tests. It's a wonder this worked at
all before for the async tests.
Update the function generation to create a coroutine function, if
appropriate.
LP: #2007554
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>