Although the script is running with -e, having two distinct invocations
of a subshell in the same instruction masks failures in the first
subshell invocation. It is similar in essence to what the pipefail
option controls.
As a consequence, the following instruction does not fail if distro-info
is not installed:
isoname=$(distro-info -d)-live-server-$(dpkg --print-architecture).iso
And therefore, we end up with something like:
isoname=-live-server-amd64.iso
Fixed by first assigning the value of $(distro-info -d) to a variable.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
We now validate the UA token when it is supplied. After the user
submits a token, we retrieve the information about the subscription.
Then based on the outcome:
* if the token is valid, we display the list of services that will be
enabled
* if the token is invalid or expired, we request the user to supply
another token
* if we are unable to validate the token, for instance because of a
network issue, then we ask the user if he wants to continue anyway or
go back and try again with (another) token.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Implemented classes that can be used to fetch information about a Ubuntu
Advantage subscription based on a UA token.
The first class queries the UA servers using the ua_client script.
The second class reads the output from .json files so it can be used
offline and without delay.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit introduces example JSON files that would simulate output of
the ua_client script, as in the following command:
$ ubuntu-advantage status \
--simulate-with-token "${token}" \
--format json
Two files are added, one for each of the following scenario:
* output when supplied a valid, non expired token
* output when supplied a valid but expired token
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
We now always call lsb_release() with the application-wide dry-run
boolean. All calls should now be consistent (i.e. without a mix of
examples and files coming from the host)
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
So that we consistently return the same value from lsb_release() across
all calls that use dry-run, the function now accepts a dry_run argument
(defaulting to False). This way, in dry-run mode, the caller does not
need to supply the path to a specific example file anymore.
lsb_release(dry_run=True) -> will load examples/lsb-release-focal
Having said that, the caller is still left with the possibility to
specify the example file by using the path argument:
lsb_release(path="example/lsb-release-impish")
The path and dry_run arguments are mutually exclusive: providing both
will result in a ValueError.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
Also, splits part of the configure() method:
- `__query_uid()` finds the username UID
- `_create_user()` creates the user set in IdentityModel
- Both methods accept a fake root path under dryrun.
The UA screen is now shown only if we are running on an LTS release.
In dry-run mode, we pretend to always be on Ubuntu focal.
To implement the possibility to skip the screen, we added another POST
resource to inform the server that we are finished configuring
UbuntuAdvantage.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
- This is a cleanup for SystemSetup per DEENG-134 and DEENG-139
- Default user should be set by the WSL launcher.
- Shutdown/reboot actions also.
- Added a structured form of communication between OOBE and launcher.
- /run/launcher-command
Introduce a new view, model and controllers pair to enable Ubuntu
Advantage from Subiquity. For now, we expect the user to input an
alphanumeric token and rely on cloud-init to enable the features
associated with the subscription.
This implementation comes with a number of limitations:
* inability to validate the token before first-boot
* inability to check what features are associated with the Ubuntu
Advantage subscription, before first-boot
* the user must input the token directly: there is no mechanism to
deduce the token based on email address and password.
The new screen is placed after the identity scree. The installation
should already be running when the UA screen will be shown to the user.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>