Commit Graph

5044 Commits

Author SHA1 Message Date
Olivier Gayot 746e559c47
Merge pull request #1342 from ogayot/u-a-c-distinguish-error-invalid
ubuntu-advantage: determine on error if token was invalid
2022-07-06 17:04:10 +02:00
Olivier Gayot 9d6bbf2b9c ubuntu-advantage: determine on error if token was invalid
In case of error, u-a-c exits with status 1. When the contract token
supplied is invalid, it is also considered an error ; which previously
made us unable to make the distinction between:
 * an invalid token
 * a more generic error such as network error or service unavailable error

Thanks to an update in u-a-c, we can now determine if the token was
invalid, by parsing the standard output of the process, even when it
exits with status 1.

The output is expected to be a JSON object that includes an array of
errors where each error has a specific error code.

The error code for an invalid token is attach-invalid-token ; which we
now look for in the output to determine if the contract token was
invalid.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-06 16:42:23 +02:00
Olivier Gayot 0fa8c54296
Merge pull request #1331 from ogayot/ubuntu-pro-visual-no-ubuntu-one
ubuntu-pro: update screens to match current design mockups
2022-07-05 16:12:15 +02:00
Olivier Gayot 7694b2c4fc ubuntu-pro: suggest the "pro" command instead of "ua"
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot 5e02c67d2e ubuntu-pro: make run_answers interact with the GUI
run_answers now interacts with the GUI for the Ubuntu Pro screens.
When a contract token is provided, it is expected to be valid,
otherwise, the UI will block on Expired token or Invalid token.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot d13ad41528 ubuntu-pro: rework expired/invalid messages boxes
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot 6e06971778 ubuntu-pro: mark token as invalid/expired in red
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot 89a2dc7987 ubuntu-pro: make services a whole screen
It also does not have a different title, because title is set at the view level.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot e69675793c ubuntu-pro: submit token asynchronously if check_token is successful
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot 84a1d38646 ubuntu-pro: add content about auto-enabled vs other services
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot af091b689c ubuntu-pro: add intermediate screen that shows token was added
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot c8ed8abe55 ubuntu-pro: add basic field validation for contract token
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-04 11:47:12 +02:00
Olivier Gayot 6025ead7de ubuntu-pro: move mode selection in a different screen
We now split the Ubuntu Pro screen into two sub views.
The first view asks whether the user wants to skip or upgrade (we call
this the upgrade_yes_no_screen in the code).

The second one asks the user to input the contract token. Going forward,
this view will also be used for Ubuntu One.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot c47a1ac231 ubuntu-pro: use "Continue" instead of "Done" for buttons
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot a2fad919c6 ubuntu-pro: drop UbuntuPro prefix in view classes
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot 9e96711ecd ubuntu-pro: add overlay to show how to register
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot f62550528e ubuntu-pro: show "token" + help instead of "contract token"
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot e87e1afde9 ubuntu-pro: use word "upgrade" rather than "enable" for Ubuntu Pro
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot f9f0ffc4cd ubuntu-pro: reword "Skip Ubuntu Pro" -> "Do this later"
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot 8abb5279d7 ubuntu-pro: add button to show ubuntu pro information
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot 329d37a19c ubuntu-pro: use checkboxes to skip or enter token
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>
2022-07-01 20:02:46 +02:00
Olivier Gayot d6f121329f ubuntu-pro: add stretchy widget to show info about Ubuntu Pro
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-07-01 20:02:46 +02:00
Olivier Gayot fcc21c53a2 ubuntu-pro: add ascii representation for continue anyway & UA services
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>
2022-07-01 20:02:46 +02:00
Olivier Gayot a9b206dedd
Merge pull request #1340 from ogayot/ubuntu-pro-subscription-information
ubuntu-pro: add subscription info in response to /ubuntu_pro/check_token
2022-07-01 16:42:14 +02:00
Dan Bungert 0e796c9956
Merge pull request #1337 from dbungert/min-size-calc
sizes: calculations for install_min and resize
2022-06-30 11:29:54 -06:00
Dan Bungert 58c1ee834e sizes: calculations for install_min and resize
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.
2022-06-30 11:14:25 -06:00
Olivier Gayot 7ebef6d609 ubuntu-pro: add subscription info in response to /ubuntu_pro/check_token
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>
2022-06-30 16:31:56 +02:00
Dan Bungert 971ba36704
Merge pull request #1339 from dbungert/bundle-ntfs3g
snapcraft: +ntfs-3g
2022-06-29 15:44:41 -06:00
Dan Bungert 8a668edf4e snapcraft: +ntfs-3g 2022-06-29 12:38:35 -06:00
Dan Bungert b786b4d876
Merge pull request #1335 from dbungert/use-async-test-case
tests: s/run_coro/IsolatedAsyncioTestCase/
2022-06-27 07:13:58 -06:00
Olivier Gayot add252a42f
Merge pull request #1334 from ogayot/leading-capital-error-message
identity: add leading capital letter to error messages
2022-06-24 10:08:11 +02:00
Dan Bungert dffb155203 tests: s/run_coro/IsolatedAsyncioTestCase/
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.
2022-06-23 17:43:14 -06:00
Dan Bungert 924e527b7b
Merge pull request #1327 from dbungert/basic-part-numbering
filesystem: non-overlapping partition numbering
2022-06-23 12:45:03 -06:00
Dan Bungert 40a6ff71d9 filesystem: number partition on creation 2022-06-23 12:07:56 -06:00
Olivier Gayot bb49114b04 filesystem: use "passphrases" instead of "passwords" in error messages
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-23 13:11:53 +02:00
Olivier Gayot 0d2432ecc1 identity: add leading capital letter to error messages
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-06-23 12:59:51 +02:00
Olivier Gayot 2bbe16206c
Merge pull request #1330 from ogayot/async-timeout
test/api: replace use of deprecated "with timeout()"
2022-06-23 11:37:50 +02:00
Dan Bungert 2ee738f93f
Merge pull request #1332 from dbungert/guided-logs
logging: storage_version, guided name/mode/disk
2022-06-22 17:25:52 -06:00
Dan Bungert 1e75a8ae32 logging: storage_version, guided name/mode/disk 2022-06-22 12:18:12 -06:00
Dan Bungert 5aa3bd3560 filesystem: better partition numbering
With a mix of preserved and non-preserved partitions, we must not
allocate a partition number already in use.
2022-06-22 12:13:10 -06:00
Dan Bungert 855e5f2667
Merge pull request #1329 from dbungert/it-will-totally-work-this-time
autoinstall: fix where ai file is copied
2022-06-22 12:09:17 -06:00
Olivier Gayot e5ac3e32e5
Merge pull request #1315 from ogayot/no-remove-overlay
ubuntu-pro: don't assume an overlay is present in show_* functions
2022-06-22 16:51:55 +02:00
Dan Bungert 1bf5ddcf0a
Merge pull request #1326 from dbungert/boot-plan-no-pgs
boot: handle small disk case
2022-06-22 07:58:54 -06:00
Dan Bungert 7335bbbc58
Merge pull request #1328 from dbungert/tests-guided
filesystem: guided lvm unit tests
2022-06-22 07:58:05 -06:00
Olivier Gayot 50315b991b test/api: replace use of deprecated "with timeout()"
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>
2022-06-22 10:25:46 +02:00
Olivier Gayot c4af1a09cf
Merge pull request #1325 from ogayot/jammy-lts
ubuntu-pro: remove hardcoded test for jammy
2022-06-22 09:27:17 +02:00
Dan Bungert 05b1b65c51 autoinstall: fix where ai file is copied
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.
2022-06-21 17:34:19 -06:00
Dan Bungert cfc793a3d4 filesystem: guided lvm unit tests 2022-06-21 15:18:03 -06:00
Dan Bungert e61a504810 boot: handle small disk case
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.
2022-06-21 10:31:36 -06:00
Olivier Gayot c84db47247 ubuntu-pro: remove hardcoded test for jammy
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>
2022-06-21 14:40:00 +02:00