Commit Graph

5734 Commits

Author SHA1 Message Date
Dan Bungert 312e010d81 test/api: refactor out a few match usages 2023-02-08 19:56:45 -07:00
Dan Bungert e86d152a69 test/api: remove first / find 2023-02-08 19:56:45 -07:00
Carlos Nihelton 6bf71db29a
Better styling 2023-02-08 17:55:08 -03:00
Dan Bungert c2f23f9cf2
Merge pull request #1556 from dbungert/format-blank
storage/v2: allow unformatted partition creation
2023-02-08 13:33:12 -07:00
Dan Bungert 0749f69c9b storage/v2: allow unformatted partition creation
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.
2023-02-08 13:09:16 -07:00
Dan Bungert fa7220512d
Merge pull request #1555 from dbungert/api-test-timeouts
test/api: mark all with timeout
2023-02-08 12:59:26 -07:00
Dan Bungert 17b42fe797 test/api: mark all with timeout 2023-02-08 12:33:34 -07:00
J-P Nurmi 10833a848f network: reset SNAP when calling netplan in dry-run mode 2023-02-08 17:49:57 +01:00
Carlos Nihelton 8d744004fe
Implements the validation on POST
Regexes following the Ubuquity approach.
API tests demonstrate the validation.
2023-02-08 11:55:42 -03:00
Carlos Nihelton a8c0a17828
Added one more item to the validation result enum
ADMIN_NAME_EMPTY

Since there is no validation at time of creating the data.
2023-02-08 11:55:08 -03:00
Olivier Gayot 5bfd6fda03 mirror: add theoretical support multiple primary sections
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>
2023-02-08 15:26:08 +01:00
Carlos Nihelton 7e2ceb9f94
Merge pull request #1550 from CarlosNihelton/ad-api-deeng-576
Active Directory API Part 1
2023-02-08 09:25:17 -03:00
Carlos Nihelton 7962bdcc9f
Shorter if clause 2023-02-08 09:05:00 -03:00
Olivier Gayot daeae3b004
Merge pull request #1547 from ogayot/apt-translated
Make sure mirror test output is translated if translation is available
2023-02-07 19:00:35 +01:00
Olivier Gayot d522487313 locale: generate the locale definition in the background
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>
2023-02-07 18:18:16 +01:00
Olivier Gayot 7bb5742685 apt: request translation when executing the mirror check
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>
2023-02-07 18:18:16 +01:00
Olivier Gayot f284d25757 utils: add parameter to avoid clearing the LC_* variables
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>
2023-02-07 18:18:16 +01:00
Carlos Nihelton f77971238f
Clearer logic on ADModel.target_packages method. 2023-02-07 14:17:49 -03:00
Carlos Nihelton fe25d07eca
Explains the return value of active_directory.POST
Returning a list of errors seems uncommon.
2023-02-06 22:52:49 -03:00
Carlos Nihelton 0ea977a6cc
Test enhancements:
- timeout
- assert equals because the success case wil return a very specific list
  of a single value: 'OK'
2023-02-06 22:37:16 -03:00
Carlos Nihelton 70819367de
Implements AD Model and Server Controller
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.
2023-02-06 22:31:06 -03:00
Carlos Nihelton ceda86031f
Defines the first API endpoint
/active_directory

Clients GET the current model or POST a new one.
Not implemented yet.
2023-02-06 22:31:05 -03:00
Carlos Nihelton bb5f6362c5
Adds vocabulary type for Active Directory support
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)
2023-02-06 22:31:03 -03:00
Dan Bungert d410022340
Merge pull request #1551 from dbungert/antirequirementism
requirements: remove
2023-02-06 17:53:23 -07:00
Dan Bungert cb9c2263e7 runtests: allow longer socket wakeup 2023-02-06 16:39:06 -07:00
Dan Bungert 6f6178c601 requirements: remove
Get em from apt
2023-02-06 16:13:22 -07:00
Dan Bungert f47874bdc9
Merge pull request #1545 from dbungert/lp-2004040
tui: turn off systemd ShowStatus
2023-02-02 07:05:53 -07:00
Dan Bungert 8dd14957c2 tui: turn off systemd ShowStatus
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.
2023-02-01 14:45:23 -07:00
Olivier Gayot e5f0e302c3
Merge pull request #1544 from ogayot/fixes-mirror-testing
Fixes and more tests for mirror testing
2023-02-01 17:58:05 +01:00
Olivier Gayot 190a469da4 mirror: add unit test for run_mirror_testing
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-31 10:15:42 +01:00
Olivier Gayot bc9ed2f0e1 mirror: fix primary and disabled components not in autoinstall data
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>
2023-01-31 10:15:42 +01:00
Olivier Gayot a8610c424f mirror: show exception type when logging mirror check error
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-31 09:28:14 +01:00
Olivier Gayot ac98851b7c mirror: fix types hints in mirror screen
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-31 09:28:11 +01:00
Michael Hudson-Doyle 845e3971f7
Merge pull request #1542 from ogayot/with-pkgresources
snapcraft: add pkg_resources to the snap
2023-01-30 10:51:59 +13:00
Olivier Gayot 85af81718e snapcraft: add pkg_resources to the snap
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>
2023-01-27 10:43:56 +01:00
Olivier Gayot 32afc4b515
Merge pull request #1528 from ogayot/enable-pro
ubuntu-pro: enable for LTS releases
2023-01-27 10:02:11 +01:00
Olivier Gayot 1fa3679008
Merge pull request #1537 from ogayot/apt-work
Test the applied apt configuration (mirror testing)
2023-01-26 09:08:08 +01:00
Dan Bungert d9e9cf3ddd
Merge pull request #1540 from dbungert/make-view-request-fix
autoinstall: adjust x-make-view-request behavior
2023-01-24 17:08:53 -07:00
Dan Bungert cf63f2bf8e test/api: also check x-status 2023-01-24 16:54:18 -07:00
Dan Bungert ec38ae9120 test/api: example of x-make-view-request 2023-01-24 16:06:37 -07:00
Dan Bungert bf6f09efa8 server: adjust x-make-view-request
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.
2023-01-24 14:58:49 -07:00
Dan Bungert 7945c96a39
Merge pull request #1539 from dbungert/string-tweak
ui/guided: TPM string tweaks
2023-01-24 11:14:49 -07:00
Dan Bungert 0ae4585658 ui/guided: TPM string tweaks
LP: #1999117
2023-01-24 10:33:20 -07:00
Olivier Gayot bf61192f7c mirror: don't handle mirror check retries differently
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-24 12:50:23 +01:00
Olivier Gayot 70b90612d1 mirror: use run_bg_task instead of storing references to tasks
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-24 12:50:23 +01:00
Olivier Gayot b0ced5afb0 async: add helper to run fire-and-forget tasks
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>
2023-01-24 12:50:23 +01:00
Olivier Gayot 082e5d9f18 apt: retrieve list of index targets using apt_pkg
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-24 12:50:23 +01:00
Olivier Gayot ab3d9be4c7 mirror: do not run mirror testing if network is not configured
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-01-24 12:50:23 +01:00
Olivier Gayot 3824734916 network: add network/has_network endpoint to check if we have network
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>
2023-01-24 12:50:23 +01:00
Olivier Gayot 35db182e89 mirror: run mirror testing in autoinstall
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>
2023-01-24 12:50:23 +01:00