Instead of relying on the contract token empty to skip Ubuntu Pro, we
now explicitly ask the user to decide if he wants to input a token or
not. This makes a small difference in that the user is now able to
supply an empty contract token. Our different implementations (i.e.,
mock & based on u-a-c) don't handle empty tokens properly, so we now
reject empty tokens.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
We now include in the docstring a visual representation of the
"ContinueAnyway" and "UA Services" overlays.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Add calculations for a suggested minimum install size that contains
padding for swap, updates, boot.
Add calculations for helping resize, to examine the space available and
make suggestions about what the existing partition might be resized to.
The response to /ubuntu_pro/check_token now includes information about
the subscription: the name of the contract and the "name" of the account.
Instead of returning the list of services as an optional field, we now
include the list of services in the subscription object. The
subscription object is itself marked optional. This is a backward
incompatible change.
{
"status": "VALID_TOKEN",
"services": [
{
"name": "esm-infra",
"description": "UA Infra: Extended Security Maintenance (ESM)",
"auto_enabled": true
}
]
}
=>
{
"status": "VALID_TOKEN",
"subscription": {
"account_name": "user@domain.com",
"contract_name": "UA Apps - Essential (Virtual)",
"services": [
{
"name": "esm-infra",
"description": "UA Infra: Extended Security Maintenance (ESM)",
"auto_enabled": true
}
]
}
}
If the token is not valid, the subscription object will be null:
{
"status": "EXPIRED_TOKEN",
"subscription": null
}
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Because the storage views lean on the implementation of
setup_password_validation from the identity screen, we were forced to
use a form with fields named "password" and "password_confirm".
This makes the code confusing because we use the "passphrase"
terminology in the storage forms.
We now leave up to the caller to specify which fields he wants to be
part of the validation ; instead of making him provide the full form.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Tests that use run_coro are at risk of being broken by the introduction
of another test using IsolatedAsyncioTestCase. Switch over to only use
IsolatedAsyncioTestCase.
Running the API tests in Ubuntu 22.04 or newer versions result in the
following warning:
DeprecationWarning: with timeout() is deprecated, use async with
timeout() instead
The deprecation message was introduced as part of async-timeout 4.0.0
The ability to use async_timeout.timeout as an async context manager
was introduced in version 1.3.0 in 2017 so there is no problem using it.
The version of python3-async-timeout present in the archives at the time
of writing is:
* 4.0.1 in jammy
* 3.0.1 in focal
* 2.0.0 in bionic
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The documentation specifies that we shall copy the autoinstall file to
/autoinstall.yaml, regardless of how we obtained the info.
This appears redundant with the reload location, so phase that out.
The BIOS boot plan check assumes that there is at least one result in
the list from gaps.parts_and_gaps(), but that isn't the case if the disk
is small.
Showed up in VM testing using cloud-localds to seed the autoinstall
file.
During the development cycle of 22.04, jammy was not yet marked an LTS
version. To have Ubuntu Pro screen fire up on that version, we had to
explicitly make an exception for Jammy.
Since Jammy is official LTS now, we can drop this explicit check.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Accept a new 'mode' parameter when using autoinstall guided storage.
The default mode is 'reformat_disk', which acts as today.
A new mode of 'use_gap' is available, which does not reformat the disk.
Update the guided_methods, particularly guided_direct. It now does a
direct call to create_partition, bypassing the increasingly complicated
partition_disk_handler, making it more similar to guided_lvm, and making
way for guided partitioning into a gap.
timeout 60 might be too short for someone with lots of network
interfaces.
Since we grab the PID and run the server in the background, the timeout
is not critically necessary.
Align with latest cloud-init schema avoid using depracated
value types for users. groups definitions in cloud-config.
Also fix get_users_and_groups to return a list instead of
dict as all call sites expected it to return a list.