diff --git a/subiquity/client/client.py b/subiquity/client/client.py
index 784d80fd..c7b24e1d 100644
--- a/subiquity/client/client.py
+++ b/subiquity/client/client.py
@@ -171,7 +171,7 @@ class SubiquityClient(TuiApplication):
"killing foreground process %s before restarting",
self.fg_proc)
self.restarting = True
- self.aio_loop.create_task(
+ asyncio.create_task(
self._kill_fg_proc(remove_last_screen, restart_server))
return
if remove_last_screen:
@@ -179,7 +179,7 @@ class SubiquityClient(TuiApplication):
if restart_server:
self.restarting = True
self.ui.block_input = True
- self.aio_loop.create_task(self._restart_server())
+ asyncio.create_task(self._restart_server())
return
if self.urwid_loop is not None:
self.urwid_loop.stop()
@@ -257,7 +257,7 @@ class SubiquityClient(TuiApplication):
app_state = app_status.state
if app_state == ApplicationState.NEEDS_CONFIRMATION:
if confirm_task is None:
- confirm_task = self.aio_loop.create_task(
+ confirm_task = asyncio.create_task(
self.noninteractive_confirmation())
elif confirm_task is not None:
confirm_task.cancel()
@@ -288,7 +288,7 @@ class SubiquityClient(TuiApplication):
await asyncio.sleep(0.5)
async def spinning_wait(message, task):
- spinner = self.aio_loop.create_task(spin(message))
+ spinner = asyncio.create_task(spin(message))
try:
return await task
finally:
@@ -385,7 +385,7 @@ class SubiquityClient(TuiApplication):
[status.event_syslog_id],
self.subiquity_event_noninteractive,
seek=True)
- self.aio_loop.create_task(
+ asyncio.create_task(
self.noninteractive_watch_app_state(status))
def _exception_handler(self, loop, context):
@@ -480,7 +480,7 @@ class SubiquityClient(TuiApplication):
for i, controller in enumerate(self.controllers.instances):
if controller.name == last_screen:
index = i
- self.aio_loop.create_task(self._select_initial_screen(index))
+ asyncio.create_task(self._select_initial_screen(index))
async def _select_initial_screen(self, index):
endpoint_names = []
@@ -530,7 +530,7 @@ class SubiquityClient(TuiApplication):
finally:
self.in_make_view_cvar.reset(tok)
if new.answers:
- self.aio_loop.create_task(self._start_answers_for_view(new, view))
+ asyncio.create_task(self._start_answers_for_view(new, view))
with open(self.state_path('last-screen'), 'w') as fp:
fp.write(new.name)
return view
@@ -561,7 +561,7 @@ class SubiquityClient(TuiApplication):
elif key == 'ctrl u':
1/0
elif key == 'ctrl b':
- self.aio_loop.create_task(self.client.dry_run.crash.GET())
+ asyncio.create_task(self.client.dry_run.crash.GET())
else:
super().unhandled_input(key)
diff --git a/subiquity/client/controllers/filesystem.py b/subiquity/client/controllers/filesystem.py
index 63909939..892935f8 100644
--- a/subiquity/client/controllers/filesystem.py
+++ b/subiquity/client/controllers/filesystem.py
@@ -68,7 +68,7 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator):
status = await self.endpoint.guided.GET()
if status.status == ProbeStatus.PROBING:
- self.app.aio_loop.create_task(self._wait_for_probing())
+ asyncio.create_task(self._wait_for_probing())
self.current_view = SlowProbing(self)
else:
self.current_view = self.make_guided_ui(status)
@@ -274,18 +274,18 @@ class FilesystemController(SubiquityTuiController, FilesystemManipulator):
self.ui.set_body(FilesystemView(self.model, self))
def guided_choice(self, choice):
- self.app.aio_loop.create_task(self._guided_choice(choice))
+ asyncio.create_task(self._guided_choice(choice))
async def _guided(self):
self.ui.set_body((await self.make_ui())())
def guided(self):
- self.app.aio_loop.create_task(self._guided())
+ asyncio.create_task(self._guided())
def reset(self, refresh_view):
log.info("Resetting Filesystem model")
self.app.ui.block_input = True
- self.app.aio_loop.create_task(self._reset(refresh_view))
+ asyncio.create_task(self._reset(refresh_view))
async def _reset(self, refresh_view):
status = await self.endpoint.reset.POST()
diff --git a/subiquity/client/controllers/network.py b/subiquity/client/controllers/network.py
index 77d946e9..a882da47 100644
--- a/subiquity/client/controllers/network.py
+++ b/subiquity/client/controllers/network.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import asyncio
import logging
import os
import shutil
@@ -117,7 +118,7 @@ class NetworkController(SubiquityTuiController, NetworkAnswersMixin):
def end_ui(self):
if self.view is not None:
self.view = None
- self.app.aio_loop.create_task(self.unsubscribe())
+ asyncio.create_task(self.unsubscribe())
def cancel(self):
self.app.prev_screen()
@@ -127,36 +128,36 @@ class NetworkController(SubiquityTuiController, NetworkAnswersMixin):
def set_static_config(self, dev_name: str, ip_version: int,
static_config: StaticConfig) -> None:
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self.endpoint.set_static_config.POST(
dev_name, ip_version, static_config))
def enable_dhcp(self, dev_name, ip_version: int) -> None:
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self.endpoint.enable_dhcp.POST(dev_name, ip_version))
def disable_network(self, dev_name: str, ip_version: int) -> None:
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self.endpoint.disable.POST(dev_name, ip_version))
def add_vlan(self, dev_name: str, vlan_id: int):
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self.endpoint.vlan.PUT(dev_name, vlan_id))
def set_wlan(self, dev_name: str, wlan: WLANConfig) -> None:
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self.endpoint.set_wlan.POST(dev_name, wlan))
def start_scan(self, dev_name: str) -> None:
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self.endpoint.start_scan.POST(dev_name))
def delete_link(self, dev_name: str):
- self.app.aio_loop.create_task(self.endpoint.delete.POST(dev_name))
+ asyncio.create_task(self.endpoint.delete.POST(dev_name))
def add_or_update_bond(self, existing_name: Optional[str],
new_name: str, new_info: BondConfig) -> None:
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self.endpoint.add_or_edit_bond.POST(
existing_name, new_name, new_info))
diff --git a/subiquity/client/controllers/progress.py b/subiquity/client/controllers/progress.py
index fba00777..cb7e6023 100644
--- a/subiquity/client/controllers/progress.py
+++ b/subiquity/client/controllers/progress.py
@@ -61,10 +61,10 @@ class ProgressController(SubiquityTuiController):
pass
def start(self):
- self.app.aio_loop.create_task(self._wait_status())
+ asyncio.create_task(self._wait_status())
def click_reboot(self):
- self.app.aio_loop.create_task(self.send_reboot_and_wait())
+ asyncio.create_task(self.send_reboot_and_wait())
async def send_reboot_and_wait(self):
try:
diff --git a/subiquity/common/errorreport.py b/subiquity/common/errorreport.py
index 31695951..651c6c8d 100644
--- a/subiquity/common/errorreport.py
+++ b/subiquity/common/errorreport.py
@@ -442,6 +442,6 @@ class ErrorReporter(object):
self.reports.insert(0, report)
self._reports_by_base[error_ref.base] = report
- loop.call_soon(loop.create_task, report.load())
+ loop.call_soon(asyncio.create_task, report.load())
return report
diff --git a/subiquity/server/controllers/cmdlist.py b/subiquity/server/controllers/cmdlist.py
index c6d49ce2..8784fb89 100644
--- a/subiquity/server/controllers/cmdlist.py
+++ b/subiquity/server/controllers/cmdlist.py
@@ -132,7 +132,7 @@ class LateController(CmdListController):
return env
def start(self):
- self.app.aio_loop.create_task(self._run())
+ asyncio.create_task(self._run())
async def _run(self):
Install = self.app.controllers.Install
diff --git a/subiquity/server/controllers/install.py b/subiquity/server/controllers/install.py
index dc8f6d60..9ad4a30c 100644
--- a/subiquity/server/controllers/install.py
+++ b/subiquity/server/controllers/install.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import asyncio
import json
import logging
import os
@@ -139,12 +140,12 @@ class InstallController(SubiquityController):
def stop_uu(self):
if self.app.state == ApplicationState.UU_RUNNING:
self.app.update_state(ApplicationState.UU_CANCELLING)
- self.app.aio_loop.create_task(self.stop_unattended_upgrades())
+ asyncio.create_task(self.stop_unattended_upgrades())
def start(self):
journald_listen(
self.app.aio_loop, [self.app.log_syslog_id], self.log_event)
- self.install_task = self.app.aio_loop.create_task(self.install())
+ self.install_task = asyncio.create_task(self.install())
def tpath(self, *path):
return os.path.join(self.model.target, *path)
diff --git a/subiquity/server/controllers/locale.py b/subiquity/server/controllers/locale.py
index 6a6b0fae..fb345719 100644
--- a/subiquity/server/controllers/locale.py
+++ b/subiquity/server/controllers/locale.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import asyncio
import logging
import os
@@ -43,7 +44,7 @@ class LocaleController(SubiquityController):
self.model.selected_language = os.environ.get("LANG") \
or self.autoinstall_default
- self.app.aio_loop.create_task(self.configured())
+ asyncio.create_task(self.configured())
self.app.hub.subscribe(
(InstallerChannels.CONFIGURED, 'source'), self._set_source)
diff --git a/subiquity/server/controllers/network.py b/subiquity/server/controllers/network.py
index 8b1c9084..ccc46f48 100644
--- a/subiquity/server/controllers/network.py
+++ b/subiquity/server/controllers/network.py
@@ -118,7 +118,7 @@ class NetworkController(BaseNetworkController, SubiquityController):
log.debug('maybe_start_install_wpasupplicant')
if self.install_wpasupplicant_task is not None:
return
- self.install_wpasupplicant_task = self.app.aio_loop.create_task(
+ self.install_wpasupplicant_task = asyncio.create_task(
self._install_wpasupplicant())
def wlan_support_install_state(self):
@@ -302,7 +302,7 @@ class NetworkController(BaseNetworkController, SubiquityController):
client = make_client_for_conn(NetEventAPI, conn)
lock = asyncio.Lock()
self.clients[socket_path] = (client, conn, lock)
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self._call_client(
client, conn, lock, "route_watch",
self.network_event_receiver.default_routes))
@@ -329,7 +329,7 @@ class NetworkController(BaseNetworkController, SubiquityController):
def _call_clients(self, meth_name, *args):
for client, conn, lock in self.clients.values():
log.debug('creating _call_client task %s %s', conn.path, meth_name)
- self.app.aio_loop.create_task(
+ asyncio.create_task(
self._call_client(client, conn, lock, meth_name, *args))
def apply_starting(self):
diff --git a/subiquity/server/controllers/shutdown.py b/subiquity/server/controllers/shutdown.py
index b203a08a..35d313e9 100644
--- a/subiquity/server/controllers/shutdown.py
+++ b/subiquity/server/controllers/shutdown.py
@@ -73,8 +73,8 @@ class ShutdownController(SubiquityController):
return self.app.interactive
def start(self):
- self.app.aio_loop.create_task(self._wait_install())
- self.app.aio_loop.create_task(self._run())
+ asyncio.create_task(self._wait_install())
+ asyncio.create_task(self._run())
async def _wait_install(self):
await self.app.controllers.Install.install_task
diff --git a/subiquity/server/server.py b/subiquity/server/server.py
index 85abd580..c544f800 100644
--- a/subiquity/server/server.py
+++ b/subiquity/server/server.py
@@ -432,7 +432,7 @@ class SubiquityServer(Application):
self.update_state(ApplicationState.ERROR)
if not self.running_error_commands:
self.running_error_commands = True
- self.aio_loop.create_task(self._run_error_cmds(report))
+ asyncio.create_task(self._run_error_cmds(report))
@web.middleware
async def middleware(self, request, handler):
diff --git a/subiquity/ui/views/error.py b/subiquity/ui/views/error.py
index b747f449..b9b27850 100644
--- a/subiquity/ui/views/error.py
+++ b/subiquity/ui/views/error.py
@@ -144,12 +144,12 @@ class ErrorReportStretchy(Stretchy):
self.report = app.error_reporter.get(ref)
self.pending = None
if self.report is None:
- self.app.aio_loop.create_task(self._wait())
+ asyncio.create_task(self._wait())
else:
connect_signal(self.report, 'changed', self._report_changed)
self.report.mark_seen()
self.interrupting = interrupting
- self.min_wait = self.app.aio_loop.create_task(asyncio.sleep(0.1))
+ self.min_wait = asyncio.create_task(asyncio.sleep(0.1))
self.btns = {
'cancel': other_btn(
@@ -268,15 +268,15 @@ class ErrorReportStretchy(Stretchy):
def _report_changed(self):
if self.pending:
self.pending.cancel()
- self.pending = self.app.aio_loop.create_task(asyncio.sleep(0.1))
- self.change_task = self.app.aio_loop.create_task(
+ self.pending = asyncio.create_task(asyncio.sleep(0.1))
+ self.change_task = asyncio.create_task(
self._report_changed_())
async def _report_changed_(self):
await self.pending
self.pending = None
await self.min_wait
- self.min_wait = self.app.aio_loop.create_task(asyncio.sleep(1))
+ self.min_wait = asyncio.create_task(asyncio.sleep(1))
if self.report:
self.error_ref = self.report.ref()
self.pile.contents[:] = [
diff --git a/subiquity/ui/views/help.py b/subiquity/ui/views/help.py
index 9c55a682..805be5e0 100644
--- a/subiquity/ui/views/help.py
+++ b/subiquity/ui/views/help.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import asyncio
import logging
import os
@@ -409,7 +410,7 @@ class HelpMenu(PopUpLauncher):
def _open(self, sender):
log.debug("open help menu")
- self.app.aio_loop.create_task(self._get_ssh_info())
+ asyncio.create_task(self._get_ssh_info())
def create_pop_up(self):
self._menu = OpenHelpMenu(self)
diff --git a/subiquity/ui/views/installprogress.py b/subiquity/ui/views/installprogress.py
index 10e46c27..f94356e6 100644
--- a/subiquity/ui/views/installprogress.py
+++ b/subiquity/ui/views/installprogress.py
@@ -13,7 +13,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import asyncio
import logging
+
from urwid import (
LineBox,
Text,
@@ -264,7 +266,7 @@ class InstallConfirmation(Stretchy):
self.app.ui.body.hide_continue()
self.app.remove_global_overlay(self)
if self.app.controllers.Progress.showing:
- self.app.aio_loop.create_task(self.app.confirm_install())
+ asyncio.create_task(self.app.confirm_install())
else:
self.app.next_screen(self.app.confirm_install())
diff --git a/subiquity/ui/views/keyboard.py b/subiquity/ui/views/keyboard.py
index 5bdac711..ede5d663 100644
--- a/subiquity/ui/views/keyboard.py
+++ b/subiquity/ui/views/keyboard.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import asyncio
import locale
import logging
@@ -258,7 +259,7 @@ class Detector:
def do_step(self, step_index):
self.abort()
- self.keyboard_view.controller.app.aio_loop.create_task(
+ asyncio.create_task(
self._do_step(step_index))
async def _do_step(self, step_index):
@@ -422,7 +423,7 @@ class KeyboardView(BaseView):
layout = data['layout']
variant = data.get('variant', layout.variants[0])
setting = KeyboardSetting(layout=layout.code, variant=variant.code)
- self.controller.app.aio_loop.create_task(self._check_toggle(setting))
+ asyncio.create_task(self._check_toggle(setting))
async def _apply(self, setting):
await self.controller.app.wait_with_text_dialog(
@@ -430,7 +431,7 @@ class KeyboardView(BaseView):
self.controller.done()
def really_done(self, setting):
- self.controller.app.aio_loop.create_task(self._apply(setting))
+ asyncio.create_task(self._apply(setting))
def cancel(self, result=None):
self.controller.cancel()
diff --git a/subiquity/ui/views/snaplist.py b/subiquity/ui/views/snaplist.py
index 2a845c8a..d51e4fd0 100644
--- a/subiquity/ui/views/snaplist.py
+++ b/subiquity/ui/views/snaplist.py
@@ -376,7 +376,7 @@ class SnapListView(BaseView):
async def _wait_load(self, spinner):
# If we show the loading screen at all, we want to show it for
# at least a second to avoid flickering at the user.
- min_wait = self.controller.app.aio_loop.create_task(asyncio.sleep(1))
+ min_wait = asyncio.create_task(asyncio.sleep(1))
data = await self.controller.get_list_wait()
await min_wait
spinner.stop()
diff --git a/subiquity/ui/views/zdev.py b/subiquity/ui/views/zdev.py
index f2fba5b5..74a4906b 100644
--- a/subiquity/ui/views/zdev.py
+++ b/subiquity/ui/views/zdev.py
@@ -18,6 +18,7 @@
Provides device activation and configuration on s390x
"""
+import asyncio
import logging
from urwid import (
@@ -83,7 +84,7 @@ class ZdevList(WidgetWrap):
self.update(new_zdevinfos)
def zdev_action(self, sender, action, zdevinfo):
- self.parent.controller.app.aio_loop.create_task(
+ asyncio.create_task(
self._zdev_action(action, zdevinfo))
def update(self, zdevinfos):
diff --git a/subiquitycore/core.py b/subiquitycore/core.py
index 3726254d..8bbd08eb 100644
--- a/subiquitycore/core.py
+++ b/subiquitycore/core.py
@@ -129,7 +129,7 @@ class Application:
async def run(self):
self.base_model = self.make_model()
- self.aio_loop.create_task(self.start())
+ asyncio.create_task(self.start())
await self.exit_event.wait()
if self._exc:
exc, self._exc = self._exc, None
diff --git a/subiquitycore/tui.py b/subiquitycore/tui.py
index a3cc052e..eb88ade7 100644
--- a/subiquitycore/tui.py
+++ b/subiquitycore/tui.py
@@ -157,7 +157,7 @@ class TuiApplication(Application):
def _show():
self.ui.block_input = False
nonlocal min_show_task
- min_show_task = self.aio_loop.create_task(
+ min_show_task = asyncio.create_task(
asyncio.sleep(MIN_SHOW_PROGRESS_TIME))
show()
@@ -190,7 +190,7 @@ class TuiApplication(Application):
async def w():
return await orig
- awaitable = task_to_cancel = self.aio_loop.create_task(w())
+ awaitable = task_to_cancel = asyncio.create_task(w())
else:
task_to_cancel = None
@@ -247,10 +247,10 @@ class TuiApplication(Application):
self.ui.set_body(view)
def next_screen(self, coro=None):
- self.aio_loop.create_task(self.move_screen(1, coro))
+ asyncio.create_task(self.move_screen(1, coro))
def prev_screen(self):
- self.aio_loop.create_task(self.move_screen(-1, None))
+ asyncio.create_task(self.move_screen(-1, None))
def select_initial_screen(self):
self.next_screen()
diff --git a/subiquitycore/ui/views/network.py b/subiquitycore/ui/views/network.py
index 255c0a24..daff5f0b 100644
--- a/subiquitycore/ui/views/network.py
+++ b/subiquitycore/ui/views/network.py
@@ -19,6 +19,7 @@ Provides network device listings and extended network information
"""
+import asyncio
import logging
from urwid import (
@@ -297,7 +298,7 @@ class NetworkView(BaseView):
self.show_stretchy_overlay(stretchy)
def _action_INFO(self, name, dev_info):
- self.controller.app.aio_loop.create_task(
+ asyncio.create_task(
self._show_INFO(dev_info.name))
_action_INFO.opens_dialog = True
diff --git a/system_setup/client/controllers/summary.py b/system_setup/client/controllers/summary.py
index 24d3bff2..7b4f75c4 100644
--- a/system_setup/client/controllers/summary.py
+++ b/system_setup/client/controllers/summary.py
@@ -28,7 +28,7 @@ class SummaryController(SubiquityTuiController):
self.summary_view = None
def start(self):
- self.app.aio_loop.create_task(self._wait_status())
+ asyncio.create_task(self._wait_status())
def cancel(self):
self.app.cancel()
@@ -37,7 +37,7 @@ class SummaryController(SubiquityTuiController):
pass
def click_reboot(self):
- self.app.aio_loop.create_task(self.send_reboot_and_wait())
+ asyncio.create_task(self.send_reboot_and_wait())
async def send_reboot_and_wait(self):
try:
diff --git a/system_setup/server/controllers/configure.py b/system_setup/server/controllers/configure.py
index e5bd26de..1214c5a6 100644
--- a/system_setup/server/controllers/configure.py
+++ b/system_setup/server/controllers/configure.py
@@ -12,6 +12,8 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+
+import asyncio
import os
import shutil
import logging
@@ -38,7 +40,7 @@ class ConfigureController(SubiquityController):
self.model = app.base_model
def start(self):
- self.install_task = self.app.aio_loop.create_task(self.configure())
+ self.install_task = asyncio.create_task(self.configure())
def __locale_gen_cmd(self) -> Tuple[str, bool]:
""" Return a tuple of the locale-gen command path and True for
diff --git a/system_setup/server/controllers/shutdown.py b/system_setup/server/controllers/shutdown.py
index c72dbadd..3e4b671c 100644
--- a/system_setup/server/controllers/shutdown.py
+++ b/system_setup/server/controllers/shutdown.py
@@ -13,6 +13,7 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
+import asyncio
import enum
import os
import logging
@@ -39,8 +40,8 @@ class SetupShutdownController(ShutdownController):
self.mode = WSLShutdownMode.COMPLETE # allow the complete mode
def start(self):
- self.app.aio_loop.create_task(self._wait_install())
- self.app.aio_loop.create_task(self._run())
+ asyncio.create_task(self._wait_install())
+ asyncio.create_task(self._run())
async def _wait_install(self):
await self.app.controllers.Install.install_task