-
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
Add support for commands with multiple arguments in custom operations #2602
Merged
didier-wenzek
merged 4 commits into
thin-edge:main
from
Ruadhri17:custom-operation-subcommands
Jan 29, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1588c2e
Add support for multiple arguments when creating LoggedCommand
Ruadhri17 a01c6d7
Support multiple arguments when executing the command
Ruadhri17 94a5eed
Add system test that check multiple arguments in custom operation
Ruadhri17 b821fdf
Add documentation part about arguments in custom operations' command
Ruadhri17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...tFramework/tests/cumulocity/custom_operation/custom_operation_multiple_args/c8y_Command_1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[exec] | ||
topic = "c8y/s/ds" | ||
on_message = "511" | ||
command = "sh /etc/tedge/operations/command_1.sh" |
2 changes: 2 additions & 0 deletions
2
...otFramework/tests/cumulocity/custom_operation/custom_operation_multiple_args/command_1.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
echo "command 1" |
26 changes: 26 additions & 0 deletions
26
...om_operation/custom_operation_multiple_args/operation_multiple_arguments_in_command.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
*** Settings *** | ||
Resource ../../../../resources/common.resource | ||
Library Cumulocity | ||
Library ThinEdgeIO | ||
|
||
Test Setup Custom Setup | ||
Test Teardown Get Logs | ||
|
||
Test Tags theme:c8y theme:operation theme:custom | ||
|
||
|
||
*** Test Cases *** | ||
Run the custom operation with multiple arguments | ||
${operation}= Cumulocity.Create Operation description=do something fragments={"c8y_Command":{"text":""}} | ||
Operation Should Be SUCCESSFUL ${operation} | ||
Should Be Equal ${operation.to_json()["c8y_Command"]["result"]} command 1\n | ||
reubenmiller marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
*** Keywords *** | ||
Custom Setup | ||
${DEVICE_SN}= Setup | ||
Set Suite Variable $DEVICE_SN | ||
Device Should Exist ${DEVICE_SN} | ||
ThinEdgeIO.Transfer To Device ${CURDIR}/command_1.sh /etc/tedge/operations/ | ||
Execute Command chmod a+x /etc/tedge/operations/command_1.sh | ||
ThinEdgeIO.Transfer To Device ${CURDIR}/c8y_Command_1 /etc/tedge/operations/c8y/c8y_Command |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Very minor: I think
try_new()
is a better name as the function now returns aResult
.