Commit Graph

6765 Commits

Author SHA1 Message Date
Michael Hudson-Doyle eb3c4bf2ee
Merge pull request #1993 from mwhudson/allow-system-seed-in-live-layer
allow system definition to be in live layer
2024-05-23 14:15:56 +12:00
Chris Peterson c5131fca5f
Merge pull request #1965 from Chris-Peterson444/autoinstall-bug-lp-2060547
identity: fail on missing section sooner
2024-05-22 23:48:37 +02:00
Chris Peterson 68ae5a4cdc source: determine variant earlier than .start()
The current check for Desktop in the identity controller doesn't
work because the variant isn't set until SourceController.start
is called. Move this logic to earlier in the sequence so that the
variant information can be referenced by later-loaded controllers.
2024-05-22 13:48:48 -07:00
Chris Peterson 3b3e3310d6 filesystem: look-ahead on reset-partition-only
The identity controller shouldn't own the logic for determining
if the filesystem controller will only install the reset partition.
Creates a utility function that can be called by the identity
controller to determine if only installing the reset partition.
2024-05-22 13:48:34 -07:00
Michael Hudson-Doyle cd3d7b1c95 tidy string literals 2024-05-22 12:09:06 +12:00
Michael Hudson-Doyle d0366229ec add docstring explaining _get_system return value 2024-05-22 12:06:32 +12:00
Chris Peterson eb155c363c
Merge pull request #1985 from Chris-Peterson444/cloud-init-schema-failure-lp-2062988
cc-extract: don't unnecessarily access data
2024-05-22 01:10:03 +02:00
Chris Peterson dea2ca2379
Merge pull request #1994 from Chris-Peterson444/merge-netplan-config
network: drop logic to split out wifi config
2024-05-14 09:07:31 -07:00
Olivier Gayot 7a2002bc6c
Merge pull request #1991 from ogayot/console-conf-uc24-next-screen
console-conf: fix calls to prev_screen without await
2024-05-10 14:32:55 +02:00
Chris Peterson 7fedee55fa identity: refactor requirements tests 2024-05-08 09:28:47 -07:00
Chris Peterson 88f8b21633 identity: move config validation to load_autoinstall_data
Moves the logic for checking if user-data or identity section is
provided (on server) in the autoinstall config to the
load_autoinstall_data function. Without this change, the exception
thrown in apply_autoinstall_config won't halt the installer until
the postinstall steps (LP: 2060547).
2024-05-08 09:28:47 -07:00
Chris Peterson 45d0c7ab87 network: drop logic to split out wifi config
In commit 9ecc4060b (PR #1911), we changed the permissions of the
written netplan config files to be stricter but still retained the
logic to separate out the wifi information. Since these both are
likely to contain secrets and also have the same permissions, we can
keep the config merged.
2024-05-07 14:58:53 -07:00
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
Olivier Gayot 0398ec8b0e console-conf: fix calls to prev_screen without await
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-05-06 12:42:11 +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
Chris Peterson 1ef2b0741a cc-extract: don't unnecessarily access data
We currently don't have plans to do anything with the _data_ of the
keys that fail to validate by cloud-init; and trying to access this
data has the potential to crash the installer if it doesn't exist,
at least at the top level (LP: #2062988).
2024-05-01 16:20:03 -07: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