Commit Graph

6707 Commits

Author SHA1 Message Date
Dan Bungert 5496effe45
Merge pull request #1953 from dbungert/rev-flock-ex
snapcraft: rev for flock-ex
2024-03-25 16:59:23 -06:00
Dan Bungert ed9aab0289 snapcraft: rev for flock-ex 2024-03-25 11:31:46 -06:00
Olivier Gayot 2d8a1ea9b3 install: use pathlib.Path.write_bytes construct instead of open + write
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-25 18:04:40 +01:00
Olivier Gayot 092cbf14df install: remove zzzz-temp-installer-unattended-upgrade after running UU
On recent installations of Ubuntu, the zzzz-installer-unattended-upgrade
file ended up in the etc/apt/apt.conf.d directory of the target system.
It is supposed to be a temporary file intended for one time invocation
of unattended-upgrade at the end of the installation.

Let's remove the file after unattended-upgrades finishes using a
try ... finally construct.

The previous implementation was doing the call to UU inside the
with open(...) block, after a manual call to .close(). This is
unnecessary, the file is automatically closed at the end of the with
block.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-25 18:04:40 +01:00
Dan Bungert bef10517bd
Merge pull request #1951 from ogayot/ubuntu.sources.curtin.old
snapcraft: bump curtin revision for apt-config warning fix
2024-03-25 10:53:52 -06:00
Olivier Gayot 09b79aeaf2 snapcraft: bump curtin revision for apt-config warning fix
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-25 14:23:06 +01:00
Dan Bungert e54354b8a3
Merge pull request #1950 from dbungert/lp-2058394-no-format-obj-on-unformatted
filesystem: handle empty string fstype partitions
2024-03-24 20:42:56 -06:00
Dan Bungert fc05e77a4c filesystem: handle empty string fstype partitions
This should not result in a format object being created, which curtin
doesn't like.  Normalize to None as the fstype to skip format object
creation.

LP: #2058394
2024-03-22 16:33:21 -06:00
Chris Peterson ed8971f0b2 server: Create an interface for server event listeners 2024-03-22 07:58:10 -07:00
Dan Bungert 03b68337d9
Merge pull request #1949 from dbungert/autoinstall-user-data-fix-comment
install: fix comment in autoinstall-user-data
2024-03-22 08:04:43 -06:00
Dan Bungert 1ec1c33da1 install: fix comment in autoinstall-user-data 2024-03-21 18:05:41 -06:00
Chris Peterson 0eb05d31e1 client: support log-like events in non-interactive installs
This changes the journal listener callback in the non-interactive
scenario to support all types of events, not just start and finish
events.

This also modifies the journal listener in the non-interactive scenario
to not seek all the way to the newest entry. In non-interactive installs,
the server can get pretty far into the installation by the time the client
can connect, so any important warnings/errors that the server reports
before then wouldn't be printed to the console by the client otherwise.
2024-03-20 16:14:28 -07:00
Chris Peterson 980411a670 reporting: add new logging type events
Adds new reporting type events "INFO", "WARNING", and "ERROR" to be
used for context logging. These can be invoked with the new `.info`,
`.warning`, and `.error` methods on the context object accordingly.
Useful for things like warning/errors on autoinstall configuartions.
2024-03-20 16:14:28 -07:00
Chris Peterson c25e28ef2c server: refactor _maybe_push_to_journal 2024-03-20 16:14:28 -07:00
Chris Peterson e0f02a74d7 server: add tests for publishing journal events
Currently there is a lot of state used to determine which events get
published to the journal. This is a baseline before changing behavor.
2024-03-20 16:14:28 -07:00
Dan Bungert 4fba6aa7d3
Merge pull request #1948 from dbungert/workflow-remove-lunar
workflows: -lunar
2024-03-20 06:24:38 -06:00
Dan Bungert 29868998cb workflows: -lunar 2024-03-19 23:02:00 -06:00
Olivier Gayot 50dacee4a1
Merge pull request #1942 from ogayot/warnings-capture
logging: capture warnings emitted using warnings.warn()
2024-03-19 13:30:29 +01:00
Olivier Gayot cc15d645f4
Merge pull request #1943 from ogayot/curl-timeout
tests: terminate curl processes on timeout
2024-03-19 09:59:57 +01:00
Olivier Gayot 612a8bbfc9 tests: terminate curl processes on timeout
When ensuring that the system-setup process can only be connected to
on the loopback interface, we spawn a bunch of `curl --interface ...`
processes. If the connection times out (which is the expectation in most
scenarios), the curl processes ended up not being terminated. Not only
this is small waste of resources, this is also causing errors on noble:

Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x745692661300>
Traceback (most recent call last):
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 126, in __del__
    self.close()
  File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 104, in close
    proto.pipe.close()
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 568, in close
    self._close(None)
  File "/usr/lib/python3.12/asyncio/unix_events.py", line 592, in _close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "/usr/lib/python3.12/asyncio/base_events.py", line 793, in call_soon
    self._check_closed()
  File "/usr/lib/python3.12/asyncio/base_events.py", line 540, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Fixed by terminating the curl processes (and waiting for them to
terminate) before exiting the script.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-19 09:21:31 +01:00
Chris Peterson 0773153ea0
Merge pull request #1940 from Chris-Peterson444/secureboot-kvm
kvm-test: add --secure-boot option
2024-03-18 09:01:44 -07:00
Olivier Gayot dfea447136 logging: capture warnings emitted using warnings.warn()
By default, warnings emitted by warnings.warn() will show on stderr. For
a TUI application, this is a problem because they will be displayed over
the UI and create visual glitches.

For parts of the UI that are regularly redrawn, the text of the warning
will eventually go away (sometimes instantly, making the warning
impossible to read).

For parts of the screen that are *not* regularly redrawn, the text of
the warning will stay until the user sends a Ctrl-L sequence.

We now make use of logging.captureWarnings() to redirect the warnings to
the log files. This prevents the UI glitches and if any warning is
emitted, we can actually find it in the logs.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-18 11:14:23 +01:00
Chris Peterson 11027c55d6 kvm-test: add --secure-boot option
Adds an option to configure the VM to load SecureBoot enabled firmware.
SecureBoot is a feature of UEFI, which means --boot (for legacy BIOS
boot) is incompatible with this flag. Providing both will result
in an error.

This will be useful for testing MOK enrollment behavior, as on reboot
you can confirm if you are presented with mokmanager or regular first
boot.
2024-03-15 15:16:39 -07:00
Chris Peterson 283cae41eb
Merge pull request #1937 from ogayot/kvm-test-nvme
kvm-test: add --disk-interface option taking either "nvme" or "virtio"
2024-03-14 15:00:53 -07:00
Olivier Gayot a874ee1235
Merge pull request #1938 from ogayot/doc-disk-match-vendor-model
doc: fix documentation of match specs for model and vendor
2024-03-14 19:22:58 +01:00
Dan Bungert 8795db334b
Merge pull request #1939 from dbungert/drop-os-prober
snapcraft: drop os-prober from the server snap
2024-03-14 11:30:06 -06:00
Dan Bungert 6fa59f5cdf snapcraft: drop os-prober from the server snap 2024-03-14 10:57:25 -06:00
Olivier Gayot 4ebfcc4fb3 doc: fix documentation of match specs for model and vendor
refs LP: #2056783

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-14 17:26:40 +01:00
Olivier Gayot 04e0418230
Merge pull request #1936 from ogayot/curtin-stas-only-of
Bump curtin rev for conditional nvme-stas installation
2024-03-14 12:38:54 +01:00
Olivier Gayot 1ae2e402b1 kvm-test: add --disk-interface option taking either "nvme" or "virtio"
The local disk that scripts/kvm-test.py creates unconditionally uses the
virtio interface. Recently in Subiquity, we did some work more closely
related to NVMe drives but kvm-test.py did not support that type of
interface.

We now add the possibility to specify the interface using the
--disk-interface option. It can only take two options:

  * --disk-interface nvme
  * --disk-interface virtio    (the default)

This should allow us to spot regressions (such as in LP: #2056730) with
more ease.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-14 10:47:05 +01:00
Olivier Gayot bd59804c36 snapcraft: bump curtin rev for conditional nvme-stas installation
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-14 09:48:05 +01:00
Olivier Gayot 0ba9dc9ed6
Merge pull request #1931 from Chris-Peterson444/cdrom-metadata
Move metadata collection to Curtin
2024-03-14 09:46:01 +01:00
Chris Peterson 5837eb90f0 model: remove reading /cdrom/.disk/info
Since Curtin now has a builtin hook to copy over information from
/cdrom/.disk, it's uncessary to repeat it in Subiquity.
2024-03-13 12:56:24 -07:00
Chris Peterson 56a785fe02 curtin: bump rev to pickup /cdrom/.disk hook
A new builtin curthook was introduced to address copying over
common metadata from /cdrom/.disk/ at install time. This addressed
copying /cdrom/.disk/info and /cdrom/.disk/ubuntu_dist_channel
(LP: #2037038).
2024-03-13 12:56:20 -07:00
Dan Bungert 7cbe4c9d61
Merge pull request #1934 from dbungert/lp-2051338
filesystem: autoinstall reformat_disk match raids
2024-03-13 12:24:03 -06:00
Dan Bungert 879b393eb5 filesystem: consider raids for has_bitlocker 2024-03-13 11:29:20 -06:00
Dan Bungert c84a94b9f9 filesystem: consider raids for use_gap 2024-03-13 11:29:20 -06:00
Dan Bungert ab7391ee8a filesystem: disk action match fail exception
Move the exception raised by manual storage actions to AutoinstallError
2024-03-13 11:29:20 -06:00
Dan Bungert e6dde2e324 filesystem: basic match logging 2024-03-13 11:29:20 -06:00
Dan Bungert d81bb5e247 filesystem: autoinstall reformat_disk match raids
Raise AutoinstallError on failed match while we're at it, better than
the "disk is None" scenario today.
2024-03-13 11:29:20 -06:00
Dan Bungert c088adf90f
Merge pull request #1935 from ogayot/curtin-systemd-offline
snapcraft: bump curtin revision for the SYSTEMD_OFFLINE handling and deb822 sources
2024-03-13 10:42:15 -06:00
Olivier Gayot 3fd013205f snapcraft: bump curtin revision for the SYSTEMD_OFFLINE handling
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-13 15:57:48 +01:00
Dan Bungert 263520ad0b
Merge pull request #1932 from dbungert/yaaaaaml
quickstart: fix autoinstall indents
2024-03-11 07:14:22 -06:00
Dan Bungert 9111298511 quickstart: fix autoinstall indents 2024-03-09 21:51:39 -07:00
Dan Bungert fdf72cb575
Merge pull request #1928 from dbungert/allow-skip-identity
Allow skip identity
2024-03-08 06:28:30 -07:00
Dan Bungert 7361d22048
Merge pull request #1929 from rkratky/FR-6783_add-ubuntu-image
Add ubuntu-image reference
2024-03-07 18:38:38 -07:00
Dan Bungert 737c3567e1 warn if no users but authorized_keys 2024-03-07 18:24:50 -07:00
Dan Bungert 6626fc2e9c identity: require in autoinstall only on server 2024-03-07 18:24:49 -07:00
Dan Bungert a38c86f085 identity: clarification of user creation handling 2024-03-07 18:24:49 -07:00
Robert Krátký 1b492981b2 Add ubuntu-image reference. 2024-03-07 15:09:47 +01:00