Commit Graph

6751 Commits

Author SHA1 Message Date
Michael Hudson-Doyle 86282f5721 refactor to avoid checking the labels in the live layer twice 2024-05-07 11:07:07 +02:00
Michael Hudson-Doyle c7fd905c6b allow system definition to be in live layer
Rather than always assuming it has to be mounted in from the layer to be
installed (snapd will now populate the seed in the target system when
its install API is called if it is empty).
2024-05-07 11:07:07 +02:00
Chris Peterson c6a1b583de
Merge pull request #1972 from Chris-Peterson444/reset-partition-bug
filesystem: reset-partition size bug
2024-05-06 12:27:36 -07:00
Chris Peterson 652f73209c filesystem: reset-partition size bug
In python, bool is a subclass of int so we can't use isinstance
to check if the user specified a size for the reset partition.
This causes autoinstall with "reset-partition: True" and
"reset-partition-only: true" to crash the installer due to creating
a reset-partition of size 1 (LP: #2061042).
2024-05-06 10:41:15 -07:00
Michael Hudson-Doyle b2e9393ddb
Merge pull request #1992 from mwhudson/rename-core-integration-test
rename "core" examples to "core-desktop"
2024-05-07 03:04:04 +12:00
Michael Hudson-Doyle d9f4f721fb rename "core" examples to "core-desktop"
We'll hopefully be able to install other kinds of core system soon.
2024-05-06 16:05:50 +02:00
Michael Hudson-Doyle 771fc1355b
Merge pull request #1984 from mwhudson/non-exhaustive-enums
subiquity.common.serialize: add a way to have a "non-exhaustive" enum
2024-05-05 18:19:15 +12:00
Michael Hudson-Doyle e3f16aaded use NonExhaustive to make snapdapi.Role an enum again 2024-05-03 17:49:20 +12:00
Michael Hudson-Doyle 5605942e70 Add a way to annotate the result of a asynchronous snapd operation 2024-05-03 17:49:20 +12:00
Michael Hudson-Doyle b53c1fffb7 subiquity.common.serialize: add a way to have a "non-exhaustive" enum
We use the subiquity.common.api stuff to talk to snapd, and use
enumerations to describe several field names. This is a bit of a
landmine in some situations because snapd can add a value to the set of
possible return values and thus cause serialization to fail. Rather than
just giving up on all of the typo-resistance of declaring enums for API
types, this adds a way to mark an enumeration as "non-exhaustive":
values that are part of the declared enum will be deserialized as values
of the enum but values that are not will be passed straight through (as
strings, in all the cases used in snapdapi.py), which conveniently will
never compare equal to an enumeration. This should let us just declare
the values of the enumerations we actually care about and not break if
we don't declare every value snapd actually uses.
2024-05-03 17:49:20 +12:00
Michael Hudson-Doyle a59ef9fba0 serialize a dict with enum keys that serialize as strings as an object
Rather than as a list of [key, value] pairs.
2024-05-03 17:49:17 +12:00
Chris Peterson 396e4d5a87
Merge pull request #1989 from Chris-Peterson444/spelling-hook-no-filenames
pre-commit: don't pass file names to spell check
2024-05-02 13:53:33 -07:00
Chris Peterson b56ea4508f pre-commit: don't pass file names to spell check
With "pass_filenames: True" (the default) the spell check entry
will be invoked as "make -C doc spelling <file1> <file2> ..."
which will cause the default Make target to be run for the specified
files, leading to errors like:

. .sphinx/venv/bin/activate; sphinx-build -M doc/some_file "." "_build"
Running Sphinx v7.3.7

Sphinx error:
Builder name doc/some_file not registered or available through entry point

Since the spelling target will check all files, we can suppress sending
any filenames.
2024-05-02 10:44:32 -07:00
Olivier Gayot d4a51027d9 Merge pull request #1944 from ogayot/noble-ui-rework
Fix UI so it runs properly with modern urwid
2024-05-02 14:25:11 +02:00
Olivier Gayot 144a2adf49 spinner: pass the app to the spinners, to make the screen redraw 2024-05-02 14:07:35 +02:00
Olivier Gayot 592714279c spinner: don't restart the spinner when .start() is called
Previously, when we called spinner.start(), we would automatically call
.stop() first to reset it.

Unfortunately, after calling stop(), the spinner mutates its visual
representation to become invisible using .set_text("").

This is a problem because after disappearing, the spinner does not
reappear instantly, which causes visual glitches depending on how often
we redraw the screen.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-05-02 14:07:35 +02:00
Olivier Gayot 0987dc5a7a spinner: add the ability to redraw after spinning
Every time a spinner "spins", it changes its visual representation. In
order for the user to see a smooth animation, we need to redraw the
spinner after each iteration. Hopefully this is not too much when
multiple spinners are visible at the same time.

For that, we give the option to pass the application to the spinner, so
that we can request a screen redraw after each iteration.

Alternatively, the user can decide not to pass the application to the
spinner, and to manage the animation themselves using calls to .spin()

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-05-02 14:07:35 +02:00
Olivier Gayot a81caf7f65 spinner: add a debug mode with extra logging
Spinners run very quickly and generate a lot of events. If we forget to
stop() a spinner, it will continue running forever until the event loop
is closed.

We now add an optional debug parameter that will cause spinner events to
be logged. It is very useful to find out if we forgot to stop spinners.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-05-02 14:07:35 +02:00
Olivier Gayot e3e365de89 ssh: stop the SSH spinner after importing a key
well it's not enough because closing the overlay only gets closed if the
user clicks on cancel

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-05-02 14:07:35 +02:00
Olivier Gayot 76815d6fa1 views: redraw screen after receiving event
Views that are dynamically updated using asynchronous events that are
handled by urwid need to be redrawn.

Ensure that such events trigger a redraw.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-05-02 14:07:35 +02:00
Olivier Gayot e129c13590 view: add way to redraw screen if the view is visible
Views can now redraw themselves using the request_redraw_if_visible()
method. Behind the scenes, it will look if the view is the currently
visible view and skip the redraw otherwise.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-05-02 14:07:35 +02:00
Dan Bungert e3b0805d3c
Merge pull request #1988 from dbungert/test-apt-mountpoint-install-tree
apt: fix mountpoint-install-tree test write dir
2024-05-01 18:21:11 -06:00
Dan Bungert acf88ac452 apt: fix mountpoint-install-tree test write dir
test_run_apt_config_check currently writes to curdir, update that to a
tempdir instead.
2024-05-01 16:30:56 -06:00
Michael Hudson-Doyle e1ca8731c7
Merge pull request #1986 from mwhudson/begin-relicensing
relicense code outside of subiquity to GPLv3-only
2024-04-30 09:58:40 +12:00
Michael Hudson-Doyle 9ff9d6c36f use newer version of AGPL-3 (very minor changes) 2024-04-30 09:58:15 +12:00
Dan Bungert a73d997b5d
Merge pull request #1983 from dbungert/lp-2063252-cryptsetup-warns
filesystem: swap options
2024-04-29 15:18:28 -06:00
Michael Hudson-Doyle 34afb5b40c update license headers outside of subiquity package 2024-04-29 09:28:40 +12:00
Michael Hudson-Doyle 295b0455c2 update license metadata 2024-04-29 09:22:04 +12:00
Dan Bungert 389a50e194
Merge pull request #1982 from dbungert/quick-test-udb
quick-test: handle ubuntu-desktop-bootstrap
2024-04-26 12:16:17 -06:00
Dan Bungert 129623cc6b quick-test: handle ubuntu-desktop-bootstrap 2024-04-26 11:51:02 -06:00
Olivier Gayot 65f8ef50d4
Merge pull request #1981 from ogayot/utcnow
Replace deprecated uses of datetime.datetime.utcnow
2024-04-26 15:58:47 +02:00
Olivier Gayot 1d7c7c051c
Merge pull request #1978 from ogayot/restricted-block-probing+nvme
filesystem: probe NVMe controllers when running the restricted probe
2024-04-26 09:14:05 +02:00
Dan Bungert 3f2529bc49 filesystem: swap options
Under some plymouth configs, cryptsetup shows warnings on boot for
underspecified cryptoswap options.  This makes the warnings go away, but
we've hardcoded some options that may change in the future.

LP: #2063252
2024-04-25 18:30:05 -06:00
Olivier Gayot c18d434439 file-util: replace use of deprecate datetime.datetime.utcnow()
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-25 17:51:14 +02:00
Olivier Gayot fa8e49457b ubuntu-advantage: compare date from two /aware/ datetime objects
The current implementation attempts to compare two datetime objects
by comparing the value returned by .timestamp().

However, one of the objects is an /aware/ datetime and the other is a
/naive/ datetime.

When calling .timestamp() on a naive datetime object, the function
expects the datetime object to represent local time. However, in our
scenario, it was UTC time.

Therefore, the comparison is slightly inaccurate and can end up
rejecting a token that is not yet expired ; or accepting one that is
about to expire.

In practice, this should rarely be a problem (a few hours is not a big
deal). But we now compare two /aware/ datetime objects to make the
comparison more correct.

Also, datetime.datetime.utcnow() (which returns a naive datetime object)
is deprecated in favor of datetime.datetime.now() (which can return an
aware datetime object if timezone information is passed).

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-25 15:59:56 +02:00
Olivier Gayot 4695078c84 ubuntu-advantage: mention that fromisoformat can handle Z suffix in Python >= 3.11
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-25 15:53:39 +02:00
Dan Bungert 26bc08b694
Merge pull request #1979 from Chris-Peterson444/24.04.1-release-pics
doc: autoinstall release notes pictures
2024-04-24 17:36:47 -06:00
Chris Peterson f3e1d6977e doc: autoinstall release notes pictures 2024-04-24 16:34:30 -07:00
Olivier Gayot 92a47635d8 filesystem: probe NVMe controllers when running the restricted probe
If block probing times out, we rerun it with the restricted set of
probes. Sadly, the restricted set does not include "nvme" so we do not
enumerate NVMe controllers. This leads to the following error if NVMe
storage devices are present:

  File "subiquity/models/filesystem.py", line 1492, in reset
    self.process_probe_data()
  File "subiquity/models/filesystem.py", line 1512, in process_probe_data
    self._orig_config = storage_config.extract_storage_config(self._probe_data)[
  File "/site-packages/curtin/storage_config.py", line 1420, in extract_storage_config
    tree = get_config_tree(cfg.get('id'), final_config)
  File "/site-packages/curtin/storage_config.py", line 313, in get_config_tree
    for dep in find_item_dependencies(item, sconfig):
  File "/site-packages/curtin/storage_config.py", line 283, in find_item_dependencies
    _validate_dep_type(item_id, dep_key, dep, config)
  File "/site-packages/curtin/storage_config.py", line 230, in _validate_dep_type
    raise ValueError(
ValueError: Invalid dep_id (nvme-controller-nvme0) not in storage config

Fixed by also enumerating NVMe controllers as part of the restricted
probe operation.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-23 09:46:39 +02:00
Dan Bungert dbcf723676
Merge pull request #1977 from dbungert/lp-2063059-ai-codecs
doc: fix indent in reference of codecs.install
2024-04-22 07:35:05 -06:00
Dan Bungert 2afd7f2fa5 doc: fix indent in reference of codecs.install 2024-04-21 18:08:49 -06:00
Dan Bungert 74c37fe0c2
Merge pull request #1976 from ogayot/curtin-string-interpolation
snapcraft: bump curtin rev for ZFS string interpolation fix
2024-04-17 08:23:42 -06:00
Olivier Gayot 4bbab28588 snapcraft: bump curtin rev for ZFS string interpolation fix
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-17 14:50:10 +02:00
Olivier Gayot aaf0d56472
Merge pull request #1968 from ogayot/server-ignore-mirror-test-offline
mirror: if the mirror test fails, suggest an offline install
2024-04-17 10:12:55 +02:00
Olivier Gayot 0bb4915c9f mirror: if mirror test fails, suggest an offline install
In the mirror screen, if the test fails and the user decides to ignore
the failure, we used to continue the installation normally ; which in
most scenarios resulted in an error at a later stage of the
installation.

Instead, we now revert to an installation without network (i.e., only
packages from the pool are considered for installation) if the user
decides to ignore the failure.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-17 09:57:15 +02:00
Dan Bungert ac60b184ff
Merge pull request #1975 from ogayot/v2-systems-log-error
storage: log snapd response text when v2/systems/{system} or v2/snaps/{snap} fails
2024-04-16 16:53:47 -06:00
Olivier Gayot b2f9ce3649 refresh: log snapd response text when v2/snaps/{snap} fails
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-16 14:59:37 +02:00
Olivier Gayot 3e9d9762fb storage: log snapd response text when v2/systems/{system} fails
When the request to v2/systems/enhanced-secureboot-desktop (or
equivalent) fails, Subiquity did not capture the reason. This makes
it difficult to understand why this call sometimes fails. We now log the
response text to understand better what's going on.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-16 14:03:01 +02:00
Dan Bungert 2550aaa7ea
Merge pull request #1974 from dbungert/quiet-splash
curtin: desktop grub.replace_linux_default False
2024-04-15 17:21:47 -06:00
Dan Bungert ecfe394bd0 curtin: desktop grub.replace_linux_default False
Grub provides "quiet splash" for GRUB_CMDLINE_LINUX_DEFAULT out of the
box, but curtin rewrites that value and drops both "quiet" and "splash".
On desktop, retain "quiet splash".

This should be configurable via autoinstall if this change is undesired.
2024-04-15 15:55:41 -06:00