-
Notifications
You must be signed in to change notification settings - Fork 56
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
Limit dynamic operation dir APIs to main device #2409 #2614
Limit dynamic operation dir APIs to main device #2409 #2614
Conversation
Codecov ReportAttention:
Additional details and impacted files
|
Robot Results
|
21d4e4c
to
09b489c
Compare
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.
Looks good, however, I want to review one more round after I get more insights about handling of custom operations.
P.S. I think this PR also needs to update user guide. For example, https://thin-edge.github.io/thin-edge.io/operate/c8y/supported_operations/#adding-new-operations is stating as below:
To add a new operation to a child device, create a new file in /etc/tedge/operations/c8y/ directory as below.
sudo -u tedge touch /etc/tedge/operations/c8y//c8y_Restart
Now the new operation will be automatically added to the list of child supported operations and will be sent to the cloud.
This is no longer applicable.
tests/RobotFramework/tests/cumulocity/firmware/firmware_operation_child_device.robot
Outdated
Show resolved
Hide resolved
self.mqtt_publisher | ||
.send( | ||
self.converter | ||
.process_operation_update_message(discovered_ops), |
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.
There is something a bit weird/overly complex/useless here.
The process_inotify_events
method carefully build a DiscoverOp
with the details of the operation update,
but the process_operation_update_message
calls try_process_operation_update_messaDiscoverOpge
which ignores all the message: DiscoverOp
content except for the message.ops_dir
which is always equals to the converter.ops_dir
.
09b489c
to
a0e11a1
Compare
a0e11a1
to
e6890b5
Compare
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.
Code and tests look good.
However, I think the doc is still not clear enough for the users who want to add a custom operation for child devices. I think we should mention
a. they can create a custom operation file for child devices
b. however, they need to declare its capability via MQTT message (probably link to the capability doc is enough)
Even though we support that, I intentionally left that out from the doc as the goal is to eventually deprecate this whole file-system based API and replace it completely with workflows. So, I didn't want to highlight a feature in the 1.0 doc that'll be deprecated soon. Especially since the existing |
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.
The code is doing what is expected. However, I have comments related to docs & tests.
tests/RobotFramework/tests/cumulocity/firmware/firmware_operation_child_device.robot
Show resolved
Hide resolved
06f1230
to
0ece474
Compare
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.
Approved
… operation [1] disabled dynamic operation reload for child devices because it needed to support nested child devices as well. For this reason, when receiving an MQTT command metadata message and registering that operation, we still need to read the operation directory and register and send all the new operations. [1]: thin-edge#2614 Signed-off-by: Marcel Guzik <[email protected]>
… operation [1] disabled dynamic operation reload for child devices because it needed to support nested child devices as well. For this reason, when receiving an MQTT command metadata message and registering that operation, we still need to read the operation directory and register and send all the new operations. [1]: thin-edge#2614 Signed-off-by: Marcel Guzik <[email protected]>
… operation [1] disabled dynamic operation reload for child devices because it needed to support nested child devices as well. For this reason, when receiving an MQTT command metadata message and registering that operation, we still need to read the operation directory and register and send all the new operations. [1]: thin-edge#2614 Signed-off-by: Marcel Guzik <[email protected]>
… operation [1] disabled dynamic operation reload for child devices because it needed to support nested child devices as well. For this reason, when receiving an MQTT command metadata message and registering that operation, we still need to read the operation directory and register and send all the new operations. [1]: thin-edge#2614 Signed-off-by: Marcel Guzik <[email protected]>
Proposed changes
/etc/tedge/operations/c8y
directory where the main device and immediate child devices keep their operation files.Types of changes
Paste Link to the issue
#2409
Checklist
cargo fmt
as mentioned in CODING_GUIDELINEScargo clippy
as mentioned in CODING_GUIDELINESFurther comments