Limit dynamic operation dir APIs to main device #2409#2614
Limit dynamic operation dir APIs to main device #2409#2614albinsuresh merged 1 commit intothin-edge:mainfrom
Conversation
Codecov ReportAttention:
Additional details and impacted files
|
Robot Results
|
21d4e4c to
09b489c
Compare
There was a problem hiding this comment.
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.
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
rina23q
left a comment
There was a problem hiding this comment.
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 |
didier-wenzek
left a comment
There was a problem hiding this comment.
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
… 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 <marcel.guzik@inetum.com>
… 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 <marcel.guzik@inetum.com>
… 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 <marcel.guzik@inetum.com>
… 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 <marcel.guzik@inetum.com>
Proposed changes
/etc/tedge/operations/c8ydirectory where the main device and immediate child devices keep their operation files.Types of changes
Paste Link to the issue
#2409
Checklist
cargo fmtas mentioned in CODING_GUIDELINEScargo clippyas mentioned in CODING_GUIDELINESFurther comments