Commit Graph

4438 Commits

Author SHA1 Message Date
Dan Bungert 96a53eff14
Merge pull request #1154 from dbungert/autoinstall-disable-components
apt: fix disable_components w/ autoinstall
2022-01-10 09:45:49 -07:00
Dan Bungert 540049143d
Merge pull request #1146 from mwhudson/lp-1954848
do not accept probert results after user has submitted a filesystem config
2022-01-10 08:51:45 -07:00
Dan Bungert 3d10a71d3c
Merge pull request #1153 from ogayot/ua-with-autoinstall
Add support for ubuntu-advantage with autoinstall
2022-01-07 15:27:41 -07:00
Dan Bungert 2a37cf5efb
Merge pull request #1155 from ogayot/fix-run-tests
Fix language packs detection in integration tests
2022-01-07 15:26:42 -07:00
Olivier Gayot 1a079ecddd Fix extraction of default locale when running integration tests
When running integration tests, the LANG variable in
.subiquity/etc/default/locale is unquoted. The pattern that we use
expects quotes so it does not match.

Fixed by making the test work with or without quotes.

In case quotes are not present, the final part of the pipeline will fail
to find a delimiter so it will print the line unchanged

excerpt from cut(1)

   -f, --fields=LIST
          select  only these fields;  also print any line that contains
          no delimiter character, unless the -s option is specified

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-07 10:42:53 +01:00
Olivier Gayot 27ac4b43b1 Fix language pack detection when running integration tests
Looking at the logs, we can observe that the below command does
not do what it is intended to do:

  if [ -z "$( ls .subiquity/var/cache/apt/archives/) | grep $lang" ] ; then

  ++ ls .subiquity/var/cache/apt/archives/
  + '[' -z 'language-pack-en:amd64
  wamerican:amd64
  wbritish:amd64 | grep ' ']'

The "| grep $lang" part does not execute because it is outside the $()
construct. Therefore, the -z check is always false.

We can fix it by moving the "| grep $lang" part inside the subshell
construct but I took the opportunity to drop the use of the subshell.

Also added --fixed-strings and --quiet options to grep.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-06 12:05:03 +01:00
Olivier Gayot 81c67780ff Add basics checks for token validity in the autoinstall JSON schema
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-06 10:54:08 +01:00
Dan Bungert 8ad8feec31
Merge pull request #1148 from CarlosNihelton/fix-wsl-shutdown
[SystemSetup] Moving pieces of configuration from Subiquity to WSL Launcher
2022-01-05 13:31:22 -07:00
Dan Bungert 9393bf1cd6 free-only: update for change to components storage 2022-01-05 12:55:05 -07:00
Dan Bungert 81d1b18222
Merge pull request #1150 from ogayot/lsb_release_dry_run
Make consistent calls to lsb_release
2022-01-05 10:54:16 -07:00
Dan Bungert 5a2a7f5ad6 apt: fix disable_components w/ autoinstall
* The mixture of storage for disable_components in and out of the config
  dict was confusing and caused bugs, depending on the flow
* disable_components now solely lives in the dict, like other items
2022-01-05 10:35:05 -07:00
Dan Bungert 68cb0d826f
Merge pull request #1152 from ogayot/fix-test-this-branch
Make sure test-this-branch.sh exits if distro-info is not installed
2022-01-05 09:58:22 -07:00
Dan Bungert ce624ad543
Merge pull request #1149 from dbungert/kvm-test-fixes
kvm-test: cleanups
2022-01-04 11:43:27 -07:00
Dan Bungert 52ede053ac kvm-test: review feedback and fixes
* fix several syntax errors
* missing 'this' item was renamed to 'iso'
* change the simulated 'bash -x' output to stderr
* use shlex functions for join/split
2022-01-04 10:58:09 -07:00
Olivier Gayot d345cf999a Use autoinstall for ubuntu-advantage in integration tests
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-04 17:58:46 +01:00
Olivier Gayot 76278f4d74 Add support for ubuntu-advantage in autoinstall
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-04 17:53:36 +01:00
Olivier Gayot 6d88618b9e Make sure test-this-branch.sh exits if distro-info is not installed
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>
2022-01-04 17:38:43 +01:00
Olivier Gayot 47ed7dbb9b Make consistent calls to lsb_release
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>
2021-12-17 17:08:21 +01:00
Olivier Gayot 475d71e166 Allow to pass dry_run boolean to lsb_release
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>
2021-12-17 16:00:52 +01:00
Carlos Nihelton e429babb03 Fixes potential false positive UID findings
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.
2021-12-17 10:35:38 -03:00
Dan Bungert 73bc16b8fb
Merge pull request #1140 from ogayot/FR-1652
Add initial integration of Ubuntu Advantage in Subiquity
2021-12-16 16:55:46 -07:00
Dan Bungert 7b3459ea9e
Merge pull request #1147 from ogayot/exception-string-interpolation
Fix exception messages not interpolated properly
2021-12-16 16:26:50 -07:00
Dan Bungert 06ac3f92b5 kvm-test: cleanups
* better command execution
* various build arguments imply --build, so one can do just '-q' where
  one would have to previously '--build -q'
2021-12-16 13:31:13 -07:00
Olivier Gayot 68b9c42fac Fix exception messages not interpolated properly
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-16 11:35:40 +01:00
Olivier Gayot 5403222956 Skip the UbuntuAdvantage screen until we can validate the token
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-16 11:07:10 +01:00
Olivier Gayot fe4b6fde6f Only show UA screen if running on LTS release
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>
2021-12-16 11:06:09 +01:00
Michael Hudson-Doyle 784a46845f
Merge pull request #1143 from mwhudson/partition-gaps
add an object to represent a gap between partitions
2021-12-16 15:51:57 +13:00
Michael Hudson-Doyle 573c8e8d05 do not accept probert results after user has submitted a filesystem config
For https://bugs.launchpad.net/bugs/1954848
2021-12-16 14:39:41 +13:00
Carlos Nihelton b17c3d3db9 Cleanup complete.
- No user setup in wsl.conf
- Shutdown controller creates the launcher-command file
2021-12-14 12:13:00 -03:00
Dan Bungert 85a3c6a526
Merge pull request #1144 from ogayot/minor-fixes
Minor fixes in Makefile and tests
2021-12-14 08:05:31 -07:00
Carlos Nihelton bad945f5d7 Remove username from wsl.conf
- 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
2021-12-14 12:04:38 -03:00
Olivier Gayot 9b638270bc Update Makefile .PHONY targets
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-13 20:20:32 +01:00
Olivier Gayot 2b34458d14 Fix typo in test class name TestSnapSnap -> TestSnap
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-13 20:15:28 +01:00
Olivier Gayot 4a60ac815b Add copyright and module docstring for snap.py
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-13 20:15:28 +01:00
Olivier Gayot bac0722e9a Remove .gitmodules since we're not using submodules anymore
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-13 20:15:28 +01:00
Olivier Gayot babe47f96c Make Makefile unit recipe use same python variable as other recipes
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2021-12-13 20:15:13 +01:00
Michael Hudson-Doyle 83cfdbdfea replace free_for_paritions with largest_gap_size 2021-12-13 20:34:25 +13:00
Michael Hudson-Doyle 5429e97854 kill off CREATE_LV action 2021-12-13 20:34:25 +13:00
Michael Hudson-Doyle 574697246d move "add partition" to gap 2021-12-13 20:34:25 +13:00
Michael Hudson-Doyle d78db0883c use parts_and_gaps in filesystem view 2021-12-13 20:34:25 +13:00
Michael Hudson-Doyle 345bd14707 add a Gap type to represent the part of a disk that is not covered by a partition 2021-12-13 20:34:23 +13:00
Michael Hudson-Doyle baa8465ded
Merge pull request #1137 from mwhudson/move-apt_configurer-to-mirror-controller
move apt configurer to mirror controller
2021-12-13 15:25:04 +13:00
Dan Bungert a55f90fc87
Merge pull request #1142 from dbungert/probert-revert
probert: rollback to pre os-prober
2021-12-08 16:25:16 -07:00
Dan Bungert 90d764af36 probert: rollback to pre os-prober
Rollback the Probert version until os-prober is correctly present in the
Subiquity snap.
2021-12-08 16:18:36 -07:00
Olivier Gayot 1c9c04d55d Add initial integration of Ubuntu Advantage in subiquity
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>
2021-12-08 23:25:39 +01:00
Michael Hudson-Doyle 447b5730ec refactor the lowerdir_for calculation and fix a bug 2021-12-09 09:52:52 +13:00
Michael Hudson-Doyle 45ef2338cd another small refactor 2021-12-09 09:52:52 +13:00
Michael Hudson-Doyle 06d42129a4 do the apt config application asap 2021-12-09 09:52:52 +13:00
Michael Hudson-Doyle 93432ccbb1 split apt configuration into two methods 2021-12-09 09:52:49 +13:00
Michael Hudson-Doyle 75d9f38dd1 refactor apt configuration a bit
using some stuff I originally wrote for livefs-editor
2021-12-09 09:51:18 +13:00