Commit Graph

78 Commits

Author SHA1 Message Date
Olivier Gayot 9e7bc5053b Add support for APT preferences through autoinstall in Subiquity
The autoinstall schema for "apt" now supports the "preferences"
configuration. Each preference element should contain the properties
described below, that 1:1 map with the keywords from apt_preferences(5):

  * package      <-> Package:
  * pin          <-> Pin:
  * pin-priority <-> Pin-Priority:

These preferences are forwarded to curtin through
subiquity-curtin-apt.conf. Support for these rules must be added to
curtin as well.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-01-11 18:42:40 +01:00
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 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
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 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
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
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
Carlos Nihelton 37758047f2 Improved control over lang packs on integration
- Dryrun should never return empty packages list unless under failure.
- runtests check if the mimic-installed files match the proper language.
2021-11-22 12:16:01 -03:00
Carlos Nihelton 1e6c4472a5 Complementary to 1127 on integration side 2021-11-17 13:26:41 -03:00
Carlos Nihelton 7eee081405 Updated runtests to look for locale files 2021-11-09 18:16:10 -03:00
Carlos Nihelton 6be4aea138 l-s-c as dep on Makefile, avoid raising exceptions
- And clear .subiquity/var/cache
2021-11-05 18:09:15 -03:00
Carlos Nihelton 5f9f2122ce System locale manipulation wired into Subiquity.
- We don't have cloud-init in WSL.
    - Subiquity must perform any actions to support the choosen locale.
    - l-s-c package added as dependency.
2021-11-05 17:29:33 -03:00
Michael Hudson-Doyle 4fa0e22b58 create a helper class for invoking curtin 2021-11-03 15:28:26 +13:00
Didier Roche 8b996f9ba5
Merge pull request #1100 from canonical/wsl_oobe_adduser_tests
WSL OOBE: add `useradd` tests
2021-10-20 09:33:46 +02:00
Patrick Wu a3fce9f9c2
system_setup: add useradd tests 2021-10-20 00:27:10 +08:00
Dan Bungert 8da3df2cd2 schema: remove timezones, and tz schema check 2021-10-19 10:06:01 -06:00
Patrick Wu ec04a6833a
system_setup: shutdown/reboot tests 2021-10-18 17:15:45 +08:00
Dan Bungert 39b3394047 runtests: fail on detected crash
* exit if a crash is detected
* intentionally not cleanup on exit, to make it easier to analyze
2021-10-12 17:17:05 -06:00
Didier Roche deab1b0859
Merge pull request #1091 from canonical/wsl_oobe_autoinstall
WSL OOBE - properly setup autoinstall
2021-10-11 09:34:59 +02:00
Patrick Wu 7ae8e108a6
system_setup: include full autoinstall system 2021-10-11 10:20:18 +08:00
Michael Hudson-Doyle 206b7ae678
Merge pull request #1092 from dbungert/source-catalog-tests
sources: add sample source catalog
2021-10-11 12:09:25 +13:00
Dan Bungert a9bf5e004b sources: add sample source catalog
* Add sample source catalog from impish iso
* Show in dryrun
* Use in one of the runtests invocations (but not really tested yet)
2021-10-08 13:02:55 -06:00
Patrick Wu 07b0407815
system_setup: refactor the testing system
1. updating testing system with the proper autoinstall schema
2. reconf mode testing included
2021-10-08 20:49:06 +08:00
Dan Bungert 3b6b89c5d9 storage/v2: create api test 2021-10-06 18:44:22 -06:00
Dan Bungert 69873d8ab2 storage/v2: test cleanup 2021-10-06 18:44:22 -06:00
Dan Bungert 7f22e91cb3 storage/v2: add api test 2021-10-06 18:44:22 -06:00
Jean-Baptiste Lallement 4a2f2af268 Run WSL tests on 20.04+
The behaviour of python regarding asynchronous packages changed between
18.04 and 20.04+. OOBE is only supported on 20.04 and higher and there
is no point in making the WSL specific code compatible with ealier
releases than 20.04

Co-authored-by: Didier Roche <didrocks@ubuntu.com>
2021-09-28 09:32:39 +02:00
Jean-Baptiste Lallement 4966173d6c Test system setup autoinstall
It also adds an argument --ignore-tz to the schema comparison test to
not fail on system where the schema has no TZ like WSL.

Co-authored-by: Didier Roche <didrocks@ubuntu.com>
2021-09-28 09:32:39 +02:00
Dan Bungert 525060be16 runtests: misc cleanup
* remove a stray space
* remove an extra call to check-yaml-fields.py, which can accept a list
  of directives
* remove an entire redundant autoinstall run that I added as part of
  bitlocker work but isn't actually verified in any way other than not
  timing out
2021-09-20 16:46:23 -06:00
Jean-Baptiste Lallement b0299f255f Added integration test for WSL
This tests covers the configuration of WSL on first boot.
2021-08-31 15:52:03 +02:00
Dan Bungert ffc4bbde0a runtests support - first API test, has_bitlocker 2021-08-09 10:41:54 -06:00
Dan Bungert c79aa602dc Proper fix for setting timezone inappropriately in dryrun
Reenable integration test for set of timezone.
Don't set it while in dryrun.
2021-07-15 10:49:32 -06:00
Michael Hudson-Doyle 545d77eeab
Merge pull request #1006 from mwhudson/lp-1936248
fix "make check" on uefi systems
2021-07-15 13:18:46 +12:00
Dan Bungert 4ed4e51a2e Workaround dryrun test actually setting timezone
Until a proper fix can be finished, remove the set of timezone from the
integration tests.
2021-07-14 19:02:42 -06:00
Michael Hudson-Doyle 18c651343d fix "make check" on uefi systems
an ESP can be on a RAID now. Also always run the integration tests in UEFI mode.
2021-07-15 08:49:10 +10:00
Dan Bungert 9f1478cd96
Add new schema comparison, robust to timezone changes (#1002)
* Add new schema comparison, robust to timezone changes

Improve the schema comparison - mostly I'm worried about the
non-timezone items, spot check the timezone list for a few that should
be there.

* Incorporate feedback - pop
2021-07-13 18:13:46 -06:00
Dan Bungert 502c1193fd
Temp disable schema check on Impish (#1000)
Impish is adding more timezones, which is cool, but breaks my schema
check, so disable this there for now and come back later with a better
answer.

Also schema check seems to need curtin.
2021-07-13 11:17:55 -06:00
Dan Bungert 40945f1823
TimeZone: autoinstall and API (FR-1184) (#986)
* TimeZone: autoinstall and API

Add support for Get/Set timezone methods.  Get means that we inquire
with GeoIP as to which timezone is suggested.  Non-availability of
GeoIP, or a previous explicit Set, means that we return the system
timezone.  Set of timezone by Post results in set of the live system
timzeone, and queuing a set of the target system by way of cloud-init.

* Add clarifying comment about _request.
2021-07-13 06:25:03 -06:00
Dan Bungert 90b1bb9eed
Refactor - drop external_temp_file (#985)
Move unattended-upgrades to part of postinstall, so it can be done
before the restore_apt_config umount, which lets us get rid of the
redundant external_temp_file logic.
2021-06-28 17:11:49 -06:00
Dan Bungert 21058464fd
make_cloudconfig - start moving cloud config generation to models (#975)
Add make_cloudconfig as a function that models should offer that allows
for generation of the cloud-config snippet.
Move snaplist and locale to this mechanism.
Add a test for snaplist output.
2021-06-08 16:54:29 -06:00
Dan Bungert 4f9de12556
Split unit / integration tests a bit (#956)
Unit tests should be quick and run frequently.
Integration tests can be longer and run less often.
Split them up.
2021-05-17 07:31:29 -06:00
Michael Hudson-Doyle 1da1ead19c add a integation test for non-rich mode 2021-05-04 12:44:41 +12:00
Michael Hudson-Doyle 3b60666495
Merge pull request #925 from mwhudson/lp-1885644-again
add all documented fields to filesystem model classes
2021-04-12 11:24:23 +12:00
Michael Hudson-Doyle 5dbd872919 add test of mount options being propagated 2021-04-06 09:16:55 +12:00
Dan Bungert a0e2e244bd
add setting policy for post-install updates via autoinstall (#920)
* Add element updates (non-UI)

This can be controlled with autoinstall
updates: security or all

Also an API for controlling this:
curl --silent --unix-socket .subiquity/socket a/updates ->
"security"
curl -d '"all"' --unix-socket .subiquity/socket a/updates

* Automated tests - log grep for default/none/all states

* Enforce possible values on Updates controller

Route all the various get/set thru 2 common functions.
Validate incoming data.
2021-03-31 13:57:53 -06:00
Dan Bungert 2c6474f3cb Lock in current schema
Accidental schema updates are unintended, so enforce that.  Schema
updates that don't break API are fine, we can handle that by manually
regenerating the schema at such time.
2021-03-03 11:31:04 -07:00
Michael Hudson-Doyle d1afc54389 switch to github actions 2021-02-18 13:01:45 +13:00
Michael Hudson-Doyle 449ad839aa update integration tests 2020-11-04 10:57:22 +13:00