Skip to content

Commit 24fedc9

Browse files
Jonathas-Conceicaootavio
authored andcommitted
Fix state names for agent v2
Signed-off-by: Jonathas-Conceicao <[email protected]>
1 parent 4bf055a commit 24fedc9

File tree

3 files changed

+16
-28
lines changed

3 files changed

+16
-28
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ jobs:
5454
echo "Unexpected entry_point response"
5555
exit 1
5656
fi
57-
if [[ "$(echo "downloading" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "cancel" ]]; then
58-
echo "Unexpected downloading response"
57+
if [[ "$(echo "download" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "cancel" ]]; then
58+
echo "Unexpected download response"
5959
exit 2
6060
fi
6161
if [[ "$(echo "error foo" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "try_again 10" ]]; then
6262
echo "Unexpected error response"
6363
exit 3
6464
fi
65-
if [[ "$(echo "rebooting" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
66-
echo "Unexpected rebooting response"
65+
if [[ "$(echo "reboot" | socat - UNIX-CONNECT:updatehub-statechange.sock)" != "" ]]; then
66+
echo "Unexpected reboot response"
6767
exit 4
6868
fi
6969

examples/state_change_listener.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def main():
5656
signal.signal(signal.SIGINT, signal_handler)
5757
signal.signal(signal.SIGQUIT, signal_handler)
5858
signal.signal(signal.SIGTERM, signal_handler)
59-
SCL.on_state_change(updatehub.listener.State.DOWNLOADING,
59+
SCL.on_state_change(updatehub.listener.State.DOWNLOAD,
6060
download_callback)
61-
SCL.on_state_change(updatehub.listener.State.REBOOTING,
61+
SCL.on_state_change(updatehub.listener.State.REBOOT,
6262
rebooting_callback)
6363
SCL.on_error(error_callback)
6464

updatehub/listener.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,18 @@
1616
@unique # pylint: disable=too-few-public-methods
1717
class State(Enum):
1818
"""
19-
A enum class that contains all states of the updatehub agent.
20-
21-
:IDLE: triggered when the agent enters a idle state (doing nothing).
22-
:POLL: triggered when the agent is waiting to probe the server for a new
23-
update on the expected schedule.
24-
:PROBE: triggered when the agent is probing the server for a new update.
25-
:DOWNLOADING: triggered when the agent is downloading a new update.
26-
:DOWNLOADED: triggered when the agent has finished downloading a new
27-
update.
28-
:INSTALLING: triggered when the agent is installing a new update.
29-
:INSTALLED: triggered when the agent has finished installing a new update.
30-
:REBOOTING: triggered when the agent is rebooting the device.
31-
:EXIT: triggered when the agent has finished execution and has exited.
19+
A enum class that contains all reported states of the updatehub agent.
20+
21+
:DOWNLOAD: triggered when the agent is about to start downloading
22+
a new update.
23+
:INSTALL: triggered when the agent is about to start installing
24+
a new update.
25+
:REBOOT: triggered when the agent is about to start rebooting the device.
3226
:ERROR: triggered when the agent has encountered an error.
3327
"""
34-
IDLE = "idle"
35-
POLL = "poll"
36-
PROBE = "probe"
37-
DOWNLOADING = "downloading"
38-
DOWNLOADED = "downloaded"
39-
INSTALLING = "installing"
40-
INSTALLED = "installed"
41-
REBOOTING = "rebooting"
42-
EXIT = "exit"
28+
DOWNLOAD = "download"
29+
INSTALL = "install"
30+
REBOOT = "reboot"
4331
ERROR = "error"
4432

4533

0 commit comments

Comments
 (0)