Commit Graph

4961 Commits

Author SHA1 Message Date
Michael Hudson-Doyle aa659e8911
Merge pull request #1180 from dbungert/workflow-remove-hirsute
workflow: -hirsute
2022-02-04 10:45:22 +13:00
Dan Bungert c260df2894 workflow: -hirsute 2022-02-03 12:21:04 -07:00
Dan Bungert ffc6efb968
Merge pull request #1177 from dbungert/serializer-list-union
serializer: fix and test for KeyError '$type'
2022-02-02 09:32:50 -07:00
Dan Bungert 37cbfb0224 serializer: fix and test for KeyError '$type' 2022-01-28 16:52:16 -07:00
Dan Bungert d158d4e701
Merge pull request #1174 from ogayot/ua-entitled-services-only
Don't list UA services that are not entitled
2022-01-28 11:13:09 -07:00
Olivier Gayot 7dfe722686 Don't list UA services that are not entitled
Instead of only checking if a given UA service is available, we now also
check if it is entitled.

 - the available field for a service refers to its availability on the
   current machine (e.g. on Focal running on a amd64 CPU) ; whereas
 - the entitled field tells us if the contract covers the service.

Therefore, we need to make sure that we only list the services that are
both "available" and "entitled".

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-28 18:58:39 +01:00
Dan Bungert 3803ae0e80
Merge pull request #1172 from ogayot/validate-output-autoinstall-data
Validate output autoinstall data in integration tests
2022-01-26 10:44:46 -07:00
Dan Bungert 59199548aa
Merge pull request #1175 from dbungert/apitest-parallel
api test: run in parallel
2022-01-26 10:44:24 -07:00
Dan Bungert 72fbbc2868 api test: parallelize
The auto setting will choose based on the number of CPUs, including
virtual cores.  For me this is a 7x speedup.
2022-01-26 10:39:23 -07:00
Dan Bungert 0f9c9eef3f options: add output_base for dryrun use
To enable parallel API testing, add an output_base argument to replace
the default '.subiquity' that is sprinkled everywhere.
2022-01-26 10:39:23 -07:00
Dan Bungert 90a2bd6f7a
Merge pull request #1173 from dbungert/os-prober-arch
snap: fix os-prober related non-amd64 build failures
2022-01-25 07:47:09 -07:00
Dan Bungert ee20eb335a
Merge pull request #1167 from dbungert/lp-1952603-nonet
snaplist: handle cancel error paths
2022-01-25 07:46:46 -07:00
Dan Bungert ee528fe6a7 controller/snaplist: protect GET against timeout 2022-01-24 17:05:30 -07:00
Dan Bungert 853c39bae7 ui/snaplist: fix initialization 2022-01-24 17:03:31 -07:00
Dan Bungert a6901ddc25 kvm-test: allow deadnet simulation with --nets -1 2022-01-24 17:03:00 -07:00
Dan Bungert 4927affbe8 snapcraft: better file selection for os-prober sed 2022-01-24 13:18:49 -07:00
Dan Bungert 54ca91038e snapcraft: show os-prober as available app 2022-01-24 12:37:48 -07:00
Dan Bungert 8318fc4617 Revert "os-prober: patch instead of sed"
This reverts commit 7bdeb6707c.
2022-01-24 12:18:41 -07:00
Dan Bungert 229e364956
Merge pull request #1171 from ogayot/bump-curtin-version
Bump curtin version to fix APT preferences being discarded
2022-01-21 17:17:16 -07:00
Didier Roche 34b621ee66
Merge pull request #1165 from CarlosNihelton/fix-wsl-snap-env
[SystemSetup] Fix L-S-C behavior under WSL snap environment
2022-01-21 15:56:42 +01:00
Olivier Gayot e2216c1d53 Run script to validate autoinstall-user-data in integration tests
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-21 13:48:43 +01:00
Olivier Gayot 2bbd4fffe6 Update example states for Subiquity to cover valid token values
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-21 13:48:43 +01:00
Olivier Gayot 7664258aa4 Make sure SSHController always yields valid autoinstall data
When running an autoinstallation with no ssh: field (which is valid),
the output autoinstall-user-data file would end up with None for the
key ssh:authorized-keys, as shown below:

  ssh:
    authorized-keys: null

Unfortunately, null is not a valid value according to the schema (which
expects a string).

Fixed by initializing the authorized_keys variable to [] instead of None
so that it yields an empty list instead of null when no autoinstall data
is loaded.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-21 13:48:43 +01:00
Olivier Gayot 85958b9404 Don't include UA token in autoinstall if empty
If no UA token is provided, the UbuntuAdvantageController will generate
autoinstall data that contains an empty string:

  ubuntu-advantage:
    token: ""

Unfortunately, this is not valid according to the JSON schema.

Fixed by not returning a token: key if the token is an empty string.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-21 13:48:43 +01:00
Olivier Gayot 535a92dad4 Add script to validate autoinstall data against JSON schema
The script can be used to validate autoinstall user data against the
schema. By default, it expects a #cloud-config header and the user-data
to be under the autoinstall: key.

By passing the --no-expect-cloudconfig, it validates the data directly.
We can use this option to validate the YAML files under
examples/autoinstall-*.yaml

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-21 13:48:43 +01:00
Olivier Gayot 1fce021585 Bump curtin version to fix APT preferences being discarded
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-21 10:07:16 +01:00
Michael Hudson-Doyle 56ddf178e4
Merge pull request #1170 from ogayot/FR-1983
Fix hanging when network is the last postinst model configured
2022-01-21 10:25:54 +13:00
Dan Bungert f0907971ed
Merge pull request #1145 from dbungert/os-prober-snap
snapcraft: add os-prober
2022-01-20 12:34:09 -07:00
Dan Bungert 583659270c
Merge pull request #1168 from ogayot/use-fuse
Add --use-fuse switch to kvm-test --install so it can run as non-root
2022-01-20 10:21:59 -07:00
Dan Bungert c9f389d1ca
Merge pull request #1169 from mwhudson/configure_once-oops
initialize MirrorController.configure_once to False
2022-01-20 10:18:26 -07:00
Olivier Gayot 81bc59019c Remove --use-fuse switch and make it the default
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-20 12:01:44 +01:00
Olivier Gayot 37f286ac93 Fix hanging when network is the last postinst model configured
When running an autoinstallation with only “network” as an interactive
section, the installation hanged after the following steps:

  finalizing installation
    running 'curtin hook'
      curtin command hook
  executing late commands

where in normal conditions, the next step is:

  final system configuration

Also, querying the meta/status endpoint at this point shows that the app
is in POST_WAIT state.

The problem is:

the network model is declared as both an “install” model and a
“postinstall” model (it is the only one we have AFAIK)
when calling .configured() for a given model, we only trigger /at max/
one event. Either:
 * install_event (if the model is an “install” model - and it is the
   last one configured)
 * postinstall_event (if the model is a “postinstall” model but not an
   “install” model - and it is the last one configured)
 * no event (as in most cases)

So when we call .configured() for the network model, we /can/ trigger
the install_event but can never trigger the postinstall event.
Therefore Subiquity, will wait forever until something triggers the
postinstall_event

Fixed by accepting to trigger the install_event and the
postinstall_event in a single call to .configured.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-20 11:35:11 +01:00
Michael Hudson-Doyle 6c2a20663b initialize MirrorController.configure_once to False
oops :/
2022-01-20 16:24:25 +13:00
Olivier Gayot f1119b02a6 Add --use-fuse switch to kvm-test --install so it can run as non-root
Passing --use-fuse to scripts/kvm-test.py allows to run as non-root.

It requires installation of the package fuseiso so the switch is
disabled by default.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-19 10:10:33 +01:00
Dan Bungert efea0c5391
Merge pull request #1162 from ogayot/fix-obvious-typing-issues
Fix some typing issues reported by mypy, including potential crash when comparing snap versions
2022-01-18 18:19:17 -07:00
Michael Hudson-Doyle 96c8b51a2e
Merge pull request #1166 from dbungert/umount-hack
mirror: don't call apt cleanup
2022-01-19 14:11:21 +13:00
Dan Bungert 213928d0f9 mirror: don't call apt cleanup
* apt cleanup often fails due to the temporary apt instances still being
  around.  Skip the cleanup step, sadly, until that bug is addressed.
2022-01-18 17:21:57 -07:00
Carlos Nihelton 0d30deac7f
Promotes the "--no-checks" to outside of dry-run
Tests in real WSL2 environment revealed that update-locale checks fails but with the "--no-checks" option it updates the locale files accordingly and when the image restarts the locale is correctly set.
2022-01-18 10:18:45 -03:00
Carlos Nihelton a14a143d55 Fix l-s-c behavior under SNAP environment.
- By passing the datadir command line option.
2022-01-17 11:57:04 -03:00
Carlos Nihelton 957d56a52f FIx unbound variable in live run 2022-01-17 10:48:58 -03:00
Olivier Gayot f196db8cd1 Fix potential crash when comparing snap versions
When comparing two snap versions that meet the following conditions, a
TypeError was raised:

 * a.major == b.major
 * a.minor == b.minor
 * a.git_build_id is None and b.git_build_id is None

Fixed by first converting the git_build_id of both variables to a float
before comapring them.

Also added a unit-test to cover this scenario.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-14 14:06:01 +01:00
Olivier Gayot de19b3abee Add type hinting for controller base class attributes
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-14 13:02:44 +01:00
Olivier Gayot 3d3994f3f3 Fix return type of __recommended_languages_pack
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-14 13:02:25 +01:00
Olivier Gayot 2708ed21e5 Fix typing for ubuntu advantage services
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-14 13:02:12 +01:00
Olivier Gayot f294a49f0b Add self argument to non-static method
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-14 11:28:38 +01:00
Dan Bungert b312a24468
Merge pull request #1161 from dbungert/udi-fixes
Fix two bug reports from ubuntu-desktop-installer
2022-01-13 13:31:10 -07:00
Dan Bungert 7f3f928cfd apt: fix lowerdir handling
lowerdir is a str, not a list
2022-01-13 13:23:45 -07:00
Dan Bungert 94eab6fc84 mirror: add missing await 2022-01-13 13:22:20 -07:00
Dan Bungert 4a672e071e
Merge pull request #1158 from ogayot/bind-uac-into-subiquity-snap
Embed ubuntu-advantage-tools into Subiquity snap and use it
2022-01-13 13:01:03 -07:00
Dan Bungert 0a5c7f585a
Merge pull request #1157 from ogayot/ui-fixes-ua
Small improvements for Ubuntu Advantage dialogs
2022-01-13 12:40:35 -07:00