Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirror: if the mirror test fails, suggest an offline install #1968

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

ogayot
Copy link
Member

@ogayot ogayot commented Apr 11, 2024

Client / TUI change

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.

Current design:
2024-04-11T11:07:57,433958092+02:00

Proposed design:

Previously proposed design

2024-04-11T11:07:27,317845628+02:00

2024-04-17T09:58:43,258322845+02:00

Note that the behavior hasn't changed if the user decides to skip the test while it is running,

Backend change

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.

LP:#2059898 and similar reports

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>
@ogayot ogayot requested a review from dbungert April 11, 2024 09:59
@ogayot
Copy link
Member Author

ogayot commented Apr 11, 2024

NOTE, when testing in a VM, I noticed another issue that is technically unrelated but prevents the user from going back to the mirror screen.

The order of the screens is "... -> Mirror -> Refresh -> Storage -> ...". After moving from Mirror to Storage, hitting Back moves us the Refresh page again ; which finds nothing to do and therefore calls .done(), moving forward to Storage again.

Will raise a launchpad bug for it. EDIT LP:#2060964

Copy link
Collaborator

@dbungert dbungert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose that we take the needed parts from this PR and add in the policy change from #1816 but do so across the board - OFFLINE_INSTALL as the fallback across the board. WDYT?

@ogayot
Copy link
Member Author

ogayot commented Apr 12, 2024

I propose that we take the needed parts from this PR and add in the policy change from #1816 but do so across the board - OFFLINE_INSTALL as the fallback across the board. WDYT?

Honestly, I've never been a fan of fallback: offline-install by default ; at least without a clear indication that an offline installation is going on. Otherwise:

  1. after installation, you might boot into an outdated (potentially vulnerable) system without realizing it
  2. if you provide a wrong network configuration (e.g., missing proxy and stuff), I'd argue that you'd probably want the installation to stop and fix your config
  3. it can't work properly (yet?) with other directives like packages: [...]. (unless everything is in the pool)

With that in mind, I'll still implement the change and we can discuss further.
#1971


log.debug("User input: {}".format(result.as_data()))
if self.has_network and self.last_status in [
MirrorCheckStatus.RUNNING,
MirrorCheckStatus.FAILED,
None,
]:
async_helpers.run_bg_task(confirm_continue_anyway())
status_is_failed = bool(self.last_status == MirrorCheckStatus.FAILED)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: bool() is redundant

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the bool construct but kept the parenthesis for readability, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... black does not like the parentheses so I guess that's why I used bool() in the first place. Will do status_is_failed = self.last_status == MirrorCheckStatus.FAILED then

@dbungert dbungert requested a review from mwhudson April 16, 2024 22:24
Copy link
Collaborator

@mwhudson mwhudson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one (annoying) question but this looks good to me otherwise.

" likely that the installation will fail."
"The check of the mirror URL failed. If you decide to continue, only"
" packages present on the installation media will be considered for"
" installation."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be hard to do in a way that is short enough to be clear but should we say something about the consequences of this, i.e. missing security updates?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of

-            "The check of the mirror URL failed. You can continue, but it is very"
-            " likely that the installation will fail."
+            "The check of the mirror URL failed. If you decide to continue, only"
+            " packages present on the installation media will be considered for"
+            " installation. Remember to install security updates after booting"
+            " your newly installed system."

@@ -227,17 +228,19 @@ async def confirm_continue_anyway() -> None:
)

if confirmed:
self.controller.done(result.url.value)
skip_archive = True if continue_skip_archive else None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The True/False/None tristate is a bit confusing but well. One thing at a time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that 🙃

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>
@ogayot ogayot force-pushed the server-ignore-mirror-test-offline branch from ca71e23 to 0bb4915 Compare April 17, 2024 07:57
@ogayot ogayot merged commit aaf0d56 into canonical:main Apr 17, 2024
10 checks passed
@ogayot ogayot deleted the server-ignore-mirror-test-offline branch April 17, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants