add autoinstall config to choose shutdown mode
This commit is contained in:
parent
7f1beb1d64
commit
a9d7e46b5f
|
@ -721,6 +721,13 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"shutdown": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"reboot",
|
||||||
|
"poweroff"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
|
|
|
@ -33,6 +33,11 @@ log = logging.getLogger("subiquity.controllers.restart")
|
||||||
class ShutdownController(SubiquityController):
|
class ShutdownController(SubiquityController):
|
||||||
|
|
||||||
endpoint = API.shutdown
|
endpoint = API.shutdown
|
||||||
|
autoinstall_key = 'shutdown'
|
||||||
|
autoinstall_schema = {
|
||||||
|
'type': 'string',
|
||||||
|
'enum': ['reboot', 'poweroff']
|
||||||
|
}
|
||||||
|
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
super().__init__(app)
|
super().__init__(app)
|
||||||
|
@ -46,6 +51,12 @@ class ShutdownController(SubiquityController):
|
||||||
self.shuttingdown_event = asyncio.Event()
|
self.shuttingdown_event = asyncio.Event()
|
||||||
self.mode = ShutdownMode.REBOOT
|
self.mode = ShutdownMode.REBOOT
|
||||||
|
|
||||||
|
def load_autoinstall_data(self, data):
|
||||||
|
if data == 'reboot':
|
||||||
|
self.mode = ShutdownMode.REBOOT
|
||||||
|
elif data == 'poweroff':
|
||||||
|
self.mode = ShutdownMode.POWEROFF
|
||||||
|
|
||||||
async def POST(self, mode: ShutdownMode, immediate: bool = False):
|
async def POST(self, mode: ShutdownMode, immediate: bool = False):
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.app.controllers.Install.stop_uu()
|
self.app.controllers.Install.stop_uu()
|
||||||
|
|
Loading…
Reference in New Issue