-
Notifications
You must be signed in to change notification settings - Fork 70
feat: support disabling cloud handling of c8y_Restart operation #3940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| paho-mqtt~=1.6.1 | ||
| python-dotenv~=1.0.0 | ||
| robotframework~=7.0.0 | ||
| robotframework-c8y @ git+https://github.com/thin-edge/robotframework-c8y.git@0.49.0 | ||
| robotframework-c8y @ git+https://github.com/thin-edge/robotframework-c8y.git@0.51.0 | ||
| robotframework-aws @ git+https://github.com/thin-edge/[email protected] | ||
| robotframework-debuglibrary~=2.5.0 | ||
| robotframework-jsonlibrary~=0.5 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,23 @@ tedge-mapper-c8y does not react to local restart operations transitions | |
| topic=te/device/main///cmd/restart/local-2222 payload={"status":"failed"} expected_status=failed c8y_fragment=c8y_Restart | ||
| topic=te/device/main///cmd/restart/local-3333 payload={"status":"successful"} expected_status=successful c8y_fragment=c8y_Restart | ||
|
|
||
| Supports disabling the Cumulocity c8y_Restart Command | ||
| Execute Command tedge config set c8y.enable.device_restart false | ||
| Execute Command rm -f /etc/tedge/operations/c8y/c8y_Restart | ||
|
Comment on lines
+36
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does a user need to do both these actions to disable the operation, or is deleting the file just done so we can verify it doesn't reappear after restarting the mapper?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I think the file still needs to be deleted if the tedge-mapper-c8y service has already been started (with the setting on)...though I didn't verify this, so maybe I'm wrong.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just confirmed that once the c8y_Restart file is created, then the user has to manually remove it as disabling the feature does not affect the supported operations list that is sent to Cumulocity. However the mapper won't react to the operation if it is sent to the cloud. We could delete the operation if present on startup though. Previously we avoided this as we thought that people might want to customize the operation handler (e.g. create the file themselves), however I don't think anyone is doing this now that we can customize the tedge-agent workflows instead. The code shows that there is only an "add_operation" function, and nothing to remove an already existing one. |
||
|
|
||
| Restart Service tedge-mapper-c8y | ||
| Service Health Status Should Be Up tedge-mapper-c8y | ||
| File Should Not Exist /etc/tedge/operations/c8y/c8y_Restart | ||
| Should Not Contain Supported Operations c8y_Restart | ||
| ${operation}= Cumulocity.Restart Device | ||
| Operation Should Be PENDING ${operation} timeout=30 | ||
|
|
||
| # Cleanup operation for cleaner logs (as pending operations pollute the test report output) | ||
| # Note: It does not need to be run under a TearDown hook as this code will only run | ||
| # if the operation is not processed, otherwise it would of been processed and thus not need cleaning up | ||
| Execute Command tedge mqtt pub c8y/s/us '505,${operation.to_json()["id"]},Cancelled operation' | ||
| Operation Should Be FAILED ${operation} | ||
|
|
||
|
|
||
| *** Keywords *** | ||
| Set Service User | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether we should use
device_restartor justrestart. I opted for a more explicit approach given that some time in the future we'll probably have a "service_restart" command.