Commit Graph

6716 Commits

Author SHA1 Message Date
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
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
Dan Bungert 5226839467
Merge pull request #1973 from dbungert/lp-2057661
snapcraft: rev for more zfs / udev fixes
2024-04-15 08:11:01 -06:00
Dan Bungert 26d1e197eb snapcraft: rev for more zfs / udev fixes 2024-04-14 11:40:22 -06:00
Dan Bungert 75200b8091
Merge pull request #1971 from ogayot/fallback-offline-install-by-default
mirror: switch default policy to OFFLINE_INSTALL by default
2024-04-12 08:19:48 -06:00
Olivier Gayot 01338fae05 mirror: switch default policy to OFFLINE_INSTALL by default
Automated installations and desktop installations will now switch to an
offline installation by default. In this mode, only packages from the
pool will be fetched.

This should allow the installation to proceed when installing from a
private network without external access to the internet.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-12 14:37:02 +02:00
Olivier Gayot 01f4db5894
Merge pull request #1970 from dbungert/lp-2060695-dpkg-grub
models/subiquity: disable cc_dpkg_grub
2024-04-12 10:08:48 +02:00
Dan Bungert 037a8c2ece models/subiquity: disable cc_dpkg_grub
On first boot, there appear to be cases where the cc_dpkg_grub module in
cloud-init is not doing the right thing, which are to be sorted out.
But for first boot to happen we have a working boot config, so let's not
perturb that.

LP: #2060695
2024-04-11 16:47:43 -06:00
Dan Bungert 1b7fc279ec
Merge pull request #1967 from dbungert/doc-makefile
Doc makefile
2024-04-11 08:13:18 -06:00
Dan Bungert 13d68ecf89 pre-commit: simplify spelling invocation 2024-04-11 08:10:14 -06:00
Dan Bungert 1dd2388def doc: fix Makefile dependencies 2024-04-11 08:10:14 -06:00
Dan Bungert 2821206661
Merge pull request #1966 from dbungert/lp-2057837-home-dataset
filesystem: datasets for /root and /home
2024-04-11 08:09:13 -06:00
Dan Bungert 19ca4b7901 filesystem: datasets for /root and /home
Partial implementation of LP: #2057837.  To create a specific dataset
for /home/$user, this requires moving where and when users are created,
which is not in plan for 24.04.
2024-04-11 08:02:11 -06:00
Olivier Gayot 5553793f43 mirror: allow to query or set if archive/mirror is used during install
The /mirror GET and POST endpoints now include a boolean field named
"use_during_installation".

* if set to True, the mirror information will be used during
  installation to fetch packages online.

* if set to False, we will only fetch packages from the pool.

In either case, the mirror information will still be used to build the
etc/apt/ directory in the target system.

Currently, the way use_during_installation is implemented is coupled
with the force_offline property of the network model. This means that
Ubuntu Pro and other stuff will be disabled too if we're skipping the
use of the archive.

NOTE: the default value for "use_during_installation" in the POST
endpoint is `null` ; which means that we should not change the current
value of force_offline.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-11 11:00:26 +02:00
Chris Peterson 979f546f27
Merge pull request #1964 from Chris-Peterson444/pre-commit-spelling
pre-commit: add spelling check
2024-04-10 14:18:25 -07:00
Olivier Gayot 6db2ff8113
Merge pull request #1961 from ogayot/lvm-size-max
storage: fix UI crash when partition size gets capped
2024-04-09 16:58:06 +02:00
Robert Krátký 797f223705
Merge pull request #1963 from rkratky/review-of-1956
Language and formatting fixes as a follow up to #1956
2024-04-09 13:14:37 +02:00
Robert Krátký 76440813bd
Merge pull request #1962 from rkratky/FR-5798_autoinstall-intro
Better introduction to autoinstall
2024-04-09 13:13:05 +02:00
Robert Krátký ce6dd33e80 Better introduction to autoinstall. 2024-04-09 12:58:51 +02:00
Chris Peterson 5a1b0e35d9 pre-commit: add spelling check
Check for any changed .rst files in the doc/ directory and run
`make spelling` if any changes are detected.

The files directives per hook have to be more restrictive than the
global hook, so this also slightly changes the files match for
the other hooks.
2024-04-05 08:58:54 -07:00
Robert Krátký 219f55258d Language and formatting fixes. 2024-04-05 15:58:08 +02:00
Olivier Gayot 15f6848dc6 storage: fix UI crash when partition size gets capped
In cda6c54b87, we introduced the accurate
size vs human readable size for the size form fields. Unfortunately, we
also introduced a regression when the size gets capped (when it exceeds
the maximum size defined on the form). Currently, specifying a size that
is beyond the maximum value fails when submitting the form with:

  [...]
  File "urwid/wimp.py", line 543, in keypress
    self._emit('click')
  File "urwid/widget.py", line 461, in _emit
    signals.emit_signal(self, name, self, *args)
  File "urwid/signals.py", line 265, in emit
    result |= self._call_callback(callback, user_arg, user_args, args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "urwid/signals.py", line 295, in _call_callback
    return bool(callback(*args_to_pass))
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "subiquitycore/ui/form.py", line 486, in _click_done
    emit_signal(self, "submit", self)
  File "urwid/signals.py", line 265, in emit
    result |= self._call_callback(callback, user_arg, user_args, args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "urwid/signals.py", line 295, in _call_callback
    return bool(callback(*args_to_pass))
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "subiquity/ui/views/filesystem/partition.py", line 636, in done
    handler(self.disk, spec, partition=self.partition, gap=self.gap)
  File "subiquity/common/filesystem/manipulator.py", line 334, in logical_volume_handler
    lv.size = align_up(spec["size"])
              ^^^^^^^^^^^^^^^^^^^^^^
  File "subiquity/models/filesystem.py", line 1382, in align_up
    return (size + block_size - 1) & ~(block_size - 1)
            ~~~~~^~~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'BoundFormField' and 'int'

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-04-05 11:20:34 +02:00
Chris Peterson 16bcfcf7ae
Merge pull request #1956 from Chris-Peterson444/top-level-autoinstall
Allow top-level autoinstall in all delivery methods
2024-04-04 14:32:37 -07:00
Chris Peterson 26761b4f1a doc: update wordlist 2024-04-04 14:26:12 -07:00
Chris Peterson aed2905db0 doc: consistent top-level autoinstall keyword
Also deletes a note to users about not needing the autoinstall keyword
in non cloud-config delivery methods. We should keep a hint in the reference
that this is available, but generally let's always suggest to use the
top-level autoinstall keyword.
2024-04-04 14:26:08 -07:00
Chris Peterson ecfc3a4df0 scripts: support top-level autoinstall in validator 2024-04-04 14:21:02 -07:00
Chris Peterson ba3dbb52ef autoinstall: Allow "autoinstall" as top-level key 2024-04-04 14:20:58 -07:00
Chris Peterson a25f2e03c1 server: refactor reading in autoinstall
Factor out reading the autoinstall data from the loading function.
Also add context logging to both the loading and reading functions.
2024-04-04 13:57:35 -07:00
Chris Peterson d77bfbe1e0
Merge pull request #1954 from Chris-Peterson444/cloud-init-schema-failures
Cloud init schema failures
2024-04-03 16:35:07 -07:00
Chris Peterson 1b2c6befbb client: CloudInitSchemaValidationError in error overlay 2024-04-03 11:22:47 -07:00
Chris Peterson 8a31c7e72f autoinstall: Query cloud-init for schema failures
Users attempting to do autoinstall may incorrectly send autoinstall
directives as cloud-config, which will result in cloud-init
schema validation errors. When loading autoinstall from cloud-config,
we now check to see if there are any cloud-init schema validation errors
and warn the user. Additionally, if the source of the error is from
a known autoinstall error, we inform the user and halt the installation
with a nonreportable AutoinstallError.
2024-04-03 11:22:44 -07:00
Olivier Gayot 224d9cde1e
Merge pull request #1957 from ogayot/target-resize-part-mounted
filesystem: don't suggest target resize if part is mounted
2024-04-02 09:53:31 +02:00
Dan Bungert 72bac06005
Merge pull request #1958 from dbungert/ubuntu-desktop-bootstrap
fix a few bootstrap renames
2024-03-28 18:34:25 -06:00
Dan Bungert 12934d7b97 scripts: update for bootstrap 2024-03-28 17:20:43 -06:00
Dan Bungert 3422e3be2e server: fix bootstrap log 2024-03-28 17:20:21 -06:00
Olivier Gayot c093059919 filesystem: don't suggest target resize if part is mounted
When a partition is mounted in the live environment (either by casper or
another process) and is selected for resize, curtin will fail when
running e2fsck (or equivalent) with an error such as:

  Resize requested for format ext4
  Resizing /dev/sdb4 of type ext4 down to 12546211840
  Running command ['e2fsck', '-p', '-f', '/dev/sdb4'] with allowed return codes [0] (capture=False)
  /dev/sdb4 is mounted.
  e2fsck: Cannot continue, aborting.

  An error occured handling 'disk-sdb': ProcessExecutionError - Unexpected error while running command.
  Command: ['e2fsck', '-p', '-f', '/dev/sdb4']
  Exit code: 8

This is what happens when casper creates a partition on the installer
media to store /var/log and /var/crash. Usually the partition is large
enough to install Ubuntu so a GuidedStorageTargetResize scenario gets
emitted.

This patch prevents the emission of a GuidedStorageTargetResize scenario
if the partition is marked as mounted already.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2024-03-28 15:59:24 +01:00