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>
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>