subiquity/subiquitycore
Dan Bungert 075b06ce70 async_helpers: make SingleInstanceTask.wait safer
SingleInstanceTask has distinct steps for creation of the object, and
starting the task.  If a different coroutine is waiting on the
SingleInstanceTask, it isn't safe to directly call
SingleInstanceTask.wait() as the task may or may not have been created
yet.

Existing code usage of SingleInstanceTask is in 4 categories, with
reguards to SingleInstanceTask.wait():
1) using SingleInstanceTask without using SingleInstanceTask.wait().
   This is unchanged.
2) using SingleInstanceTask.wait without a check on task is not None.
   This may be safe now, but is fragile in the face of innocent-looking
   refactors around the SingleInstanceTask.
3) using SingleInstanceTask.wait after confirming that the task is not
   None.  This is fine but a leaky abstraction.
4) directly waiting on the SingleInstanceTask.task.  Another leaky
   abstraction, but it's solving a cancellation problem.  Leaving this
   alone.

By enhancing SingleInstanceTask.wait(), cases 2 and 3 are improved.  The
code not checking the task today is made safer, and the code checking
the task today can be simplified.
2023-03-13 15:50:33 -06:00
..
controllers network: do not accept route metric > 20000 2023-02-21 13:30:05 -07:00
models network: add override mechanism to force offline install 2023-02-15 09:05:14 +01:00
testing support for editing existing partitions 2019-05-30 15:10:54 +12:00
tests async_helpers: make SingleInstanceTask.wait safer 2023-03-13 15:50:33 -06:00
ui network: use pyroute2 to manage default routes 2023-02-21 13:30:05 -07:00
__init__.py pyflakes3 fixes for subiquitycore/__init__.py 2018-05-24 16:59:31 -05:00
async_helpers.py async_helpers: make SingleInstanceTask.wait safer 2023-03-13 15:50:33 -06:00
context.py add a mode argument to shutdown to allow reboot or power off 2021-08-22 09:36:41 +12:00
controller.py Add type hinting for controller base class attributes 2022-01-14 13:02:44 +01:00
controllerset.py fixes for how install failures are presented 2020-09-21 14:01:23 +12:00
core.py many: s/create_task/run_bg_task/ 2023-02-13 14:56:07 -07:00
file_util.py file_util: generate_timestamped_header function to any subiquity written files 2022-07-14 21:48:51 -06:00
i18n.py remove stdlib backports from Python 3.8 2021-10-12 18:55:09 -06:00
log.py logging: 0770 log dir in install env, 0750 later 2022-03-11 12:44:22 -07:00
lsb_release.py Add type hints where necessary to make mypy happy 2022-04-06 11:23:34 +02:00
netplan.py do not log wifi passwords from existing configs 2020-05-19 07:47:33 +12:00
palette.py Merge pull request #1393 from CarlosNihelton/fix-gray-contrast 2022-08-24 08:44:45 -06:00
prober.py probert: implement os prober arg 2022-03-29 15:09:21 -06:00
pubsub.py loop: invoke asyncio.create_task() directly 2022-10-28 17:05:54 +02:00
screen.py Move the code for setting up the screen to its own file 2020-07-27 23:40:17 +12:00
snapd.py call into snapd to set up encryption when required 2022-11-11 14:46:44 +13:00
ssh.py fix getting ssh info when sshd is not installed 2022-11-30 11:12:51 +13:00
tui.py many: s/create_task/run_bg_task/ 2023-02-13 14:56:07 -07:00
tuicontroller.py simple replacement for urwid signals wrapper as used in server 2021-04-13 09:41:43 +12:00
utils.py utils: add parameter to avoid clearing the LC_* variables 2023-02-07 18:18:16 +01:00
view.py ui: add a helper to open a confirmation dialog and get the response 2023-01-05 09:54:51 +01:00