show_* functions from the UbuntuProView object always assumed that the
loading overlay was present. When called, they would therefore attempt
to close the overlay. This results in a crash if no overlay is present.
With the current design, it is fine because we never call the show_*
functions without an overlay being present.
However, with new design of Ubuntu Pro, sometimes the show_* functions
will be called without an overlay.
We now delegate the responsibility of removing the overlay by using a
callback system.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
The JSON returned by uaclient for a status request contains the
auto_enabled property for each service. This property tells whether a
given service is enabled automatically when `ua attach` is done. We will
need this information going forward so we now include it in the success
response to /ubuntu_pro/check_token:
{
"status": "VALID_TOKEN",
"services": [
{
"name": "esm-infra",
"description": "UA Infra: Extended Security Maintenance (ESM)",
"auto_enabled": true
},
{
"name": "fips",
"description": "NIST-certified core packages",
"auto_enabled": false
}
]
}
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Instead of using isinstance(self.widget, SubFormWidget) in
BoundFormField.is_in_error, we now implement a BoundSubFormField
class that inherits from BoundFormField. It is meant to be instantianted
for subforms fields only.
This class overrides is_in_error() to perform the additional checks in
the forms' sub-fields.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
When the validation of a field fails in a form, we disable the Done
button. With child forms, however, it did not work because they have
their own set of hidden buttons ; that are not the ones the users
interacts with.
This patch makes parent forms recurse on the child forms when checking
if any field is in error. Also, when a child form undertakes validation,
it now propagates to the parent, so that the done button can be
immediately enabled/disabled.
Having a validation error in a child form that is not currently enabled
should not prevent the user from moving forward, so we disable recursion
for child forms that are disabled.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
lang-packs post-install hook executes locale-gen.
For certain languages a matrix of locales is generated.
Re-running locale-gen regenerates not only the locale we wanted,
but the whole matrix, causing further delays.
We can save up to 40s (tested on my laptop) by skipping locale-gen if
apt succeeded.
Still useful to run it unconditionally i dry-run since apt won't execute
any post-install hook.