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>
We used to set LC_ALL=C unconditionally when executing a command. This
is a problem if we want the output of a specific command to be
translated (provided a locale definition and an actual translation exist
for the requested language).
This patch adds the clean_locale parameter, which can be used to specify
if we want the locale variable to be cleaned, to most of the helpers
that execute commands.
The value defaults to True so the default behavior is preserved.
If one wants a command to be translated, they have to explicitly pass
clean_locale=False.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Plus the first lines of test.
**Notice that the AD Controller is not required.**
POST'ing still incomplete: just a placeholder method to enable cycling
between testing and writing code.
Now testing the API is possible.
ADConnectionInfo to be the model data submited by clients
ADValidationResult models the enum returned from a POST request.
(input must be validated in the server)
During TUI launch, turn systemd ShowStatus off. We don't want to do that
earlier, if we did then the easier path would be quiet boot or something
similar. This is done here so that service completion messages don't
overwrite the console.
In the following patches, we detached the disabled components and the
primary section from the config object in the mirror model.
c13edb07f mirror: detach disabled-components from config
8c29f3475 mirror: detach primary section from config object
However, the patches introduced a regression. The disable_components &
primary autoinstall section are not included in the
autoinstall-user-data file anymore.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
From subiquity, we sometimes execute entry point python scripts such as:
* usr/bin/ubuntu-advantage
* usr/bin/ssh-import-id
Those scripts require pkg_resources on core20 to run properly:
from pkg_resources import load_entry_point
On core22, the scripts will be a bit more flexible but for now, we need
python3-pkg-resources in the snap.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
With autoinstall, a controller that was not interactive would decline
outright to provide the response to GET queries, with the notion that
the controller needed to be skipped. Limit this behavior to only when
`x-make-view-request: yes` is set, which let's the client be able to get
the real response, or the skip info, depending on need.
calling asyncio.create_task(...) without storing a reference to the
result can lead to the task being garbage collected before it actually
executed.
https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
The documentation gives an example of a reliable way to run
fire-and-forget background tasks.
This patch adds an helper to do exactly that.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Many views provide a different display based on whether the network is
available. Up to now, it was up to the controller corresponding to the
view to return the value of has_network.
We now have a dedicated /network/has_network endpoint that clients can
lean on.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
For autoinstalls, we now perform mirror testing as well. Unlike in
interactive mode, if the mirror check fails, we wait 10 seconds and try
again. Only if the second check fails, we give up.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
For answers-based runs, we now wait for the mirror check to be complete
before submitting the form. This ensures that we don't get a
confirmation dialog if the check is successful.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
From the mirror view, we used to call /mirror/check_mirror/progress
every second, we can now check more often according to the value of
SUBIQUITY_REPLAY_TIMESCALE.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>