Skip to content

Commit 0f2a2f5

Browse files
Luan Rafael Carneirootavio
authored andcommitted
Add prepare local install
Add prepare local install to local updates. This commit changes the following files: - examples/state_change_listener.py - updatehub/listener.py Signed-off-by: Luan Rafael Carneiro <[email protected]>
1 parent 14950c6 commit 0f2a2f5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

examples/state_change_listener.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def download_callback(_state, handler):
2323
print("it will cancel the transition")
2424
handler.cancel()
2525

26+
def prepare_local_install_callback(_state, handler):
27+
print("function called when starting the Prepare local install state")
28+
print("it will cancel the transition")
29+
handler.cancel()
2630

2731
def install_callback(_state, handler):
2832
print("function called when starting the Install state")
@@ -38,13 +42,15 @@ def rebooting_callback(_state, _handler):
3842
def main():
3943
"""
4044
Main method. Instantiates a StateChange, adds callbacks to the
41-
download state and the install state and then starts the listener.
45+
download state, prepare local install state, install state,
46+
reboot state and then starts the listener.
4247
"""
4348
signal.signal(signal.SIGINT, signal_handler)
4449
signal.signal(signal.SIGQUIT, signal_handler)
4550
signal.signal(signal.SIGTERM, signal_handler)
4651

4752
SCL.on_state(updatehub.listener.State.DOWNLOAD, download_callback)
53+
SCL.on_state(updatehub.listener.State.PREPARE_LOCAL_INSTALL, prepare_local_install_callback)
4854
SCL.on_state(updatehub.listener.State.INSTALL, install_callback)
4955
SCL.on_state(updatehub.listener.State.REBOOT, rebooting_callback)
5056

updatehub/listener.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class State(Enum):
2929
"""
3030
PROBE = "probe"
3131
DOWNLOAD = "download"
32+
PREPARE_LOCAL_INSTALL = "prepare_local_install"
3233
INSTALL = "install"
3334
REBOOT = "reboot"
3435
ERROR = "error"

0 commit comments

Comments
 (0)