Merge pull request #1362 from ogayot/fde-curtin-application-state

meta/status: replace POST_WAIT and POST_RUNNING by generic states
This commit is contained in:
Olivier Gayot 2022-07-26 09:27:22 +02:00 committed by GitHub
commit c8a5292608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 14 deletions

View File

@ -56,16 +56,27 @@ class ErrorReportRef:
class ApplicationState(enum.Enum):
""" Represents the state of the application at a given time. """
# States reported during the initial stages of the installation.
STARTING_UP = enum.auto()
CLOUD_INIT_WAIT = enum.auto()
EARLY_COMMANDS = enum.auto()
WAITING = enum.auto()
# State reported once before starting destructive actions.
NEEDS_CONFIRMATION = enum.auto()
# States reported during installation. This sequence should be expected
# multiple times until we reach the late stages.
WAITING = enum.auto()
RUNNING = enum.auto()
POST_WAIT = enum.auto()
POST_RUNNING = enum.auto()
# States reported while unattended-upgrades is running.
# TODO: check if these should be dropped in favor of RUNNING.
UU_RUNNING = enum.auto()
UU_CANCELLING = enum.auto()
# Final state
DONE = enum.auto()
ERROR = enum.auto()
EXITED = enum.auto()

View File

@ -168,11 +168,11 @@ class InstallController(SubiquityController):
await self.curtin_install(
context=context, source='cp://' + for_install_path)
self.app.update_state(ApplicationState.POST_WAIT)
self.app.update_state(ApplicationState.WAITING)
await self.model.wait_postinstall()
self.app.update_state(ApplicationState.POST_RUNNING)
self.app.update_state(ApplicationState.RUNNING)
await self.postinstall(context=context)

View File

@ -290,7 +290,7 @@ class TestFlow(TestAPI):
"token": "a1b2c3d4e6f7g8h9I0K1",
}
await inst.post('/ubuntu_pro', ua_params)
for state in 'RUNNING', 'POST_WAIT', 'POST_RUNNING', 'UU_RUNNING':
for state in 'RUNNING', 'WAITING', 'RUNNING', 'UU_RUNNING':
await inst.get('/meta/status', cur=state)
@timeout()

View File

@ -156,12 +156,6 @@ class ProgressView(BaseView):
elif state == ApplicationState.RUNNING:
self.title = _("Installing system")
btns = [self.view_log_btn]
elif state == ApplicationState.POST_WAIT:
self.title = _("Installing system")
btns = [self.view_log_btn]
elif state == ApplicationState.POST_RUNNING:
self.title = _("Installing system")
btns = [self.view_log_btn]
elif state == ApplicationState.UU_RUNNING:
self.title = _("Install complete!")
self.reboot_btn.base_widget.set_label(

View File

@ -384,9 +384,9 @@ class ConfigureController(SubiquityController):
await self.model.wait_postinstall()
self.app.update_state(ApplicationState.POST_WAIT)
self.app.update_state(ApplicationState.WAITING)
self.app.update_state(ApplicationState.POST_RUNNING)
self.app.update_state(ApplicationState.RUNNING)
variant = self.app.variant
root_dir = self.model.root