Skip to content
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

Feature/extend inventory functions #90

Merged

Conversation

pasco1995
Copy link
Contributor

Added functions

  • to get all inventory items
  • to change existing inventory item's value
  • [to get an existing keystore item's index]

@joelguittet joelguittet self-assigned this Nov 21, 2024
@joelguittet joelguittet added the enhancement New feature or request label Nov 21, 2024
Copy link
Owner

@joelguittet joelguittet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @pasco1995

Really good contribution with respect of the current code format and comments, I really appreciate it! I executed the Sonarcloud analysis, nothing to report. Some few minor comments.
I also suggest to cleanup the commits. 2 commits are enough and I usually (must have) use the following format: "topic: purpose" so this can for example in this PR:

  • "core: utils: add function to get item index in key-store"
  • "add-ons: inventory: add function to update a single item in the inventory"

Thanks for your contribution to this project
Joel

include/mender-inventory.h Outdated Show resolved Hide resolved
include/mender-utils.h Outdated Show resolved Hide resolved
core/src/mender-utils.c Show resolved Hide resolved
core/src/mender-utils.c Outdated Show resolved Hide resolved
add-ons/inventory/src/mender-inventory.c Outdated Show resolved Hide resolved
@pasco1995 pasco1995 force-pushed the feature/extend_inventory_functions branch from dcb2e83 to 0a33422 Compare November 22, 2024 20:11
core/src/mender-utils.c Outdated Show resolved Hide resolved
@joelguittet
Copy link
Owner

Thanks @pasco1995 for the update, and my sincere apologize for the delay to review it.
The commit 54bc3a6 is not good, it shows a lot of files modified, which is not normal. Probably you simply just need to rebase your branch on top of master after updating your fork. Please tell me if you need some assistance for that, I'm happy to help if required.
Also one minor improvement I have seen in the function used to search for the item index.
The CI also blocks for the code format. You can execute "./.github/workflow/do_code_format.sh" to fix it.

Regards
Joel

@joelguittet
Copy link
Owner

Hello @pasco1995
Any news here ?
Joel

@pasco1995
Copy link
Contributor Author

Hello @pasco1995 Any news here ? Joel

Hello, try to fix it this weekend.

@pasco1995 pasco1995 force-pushed the feature/extend_inventory_functions branch from fdfa12b to ee92a44 Compare January 4, 2025 11:10
@joelguittet
Copy link
Owner

Hello @pasco1995
Thanks for the update, look good except the code format checking not passing, no more comment on the code and Sonar testing passing.
If you have properly executed the do_code_format.sh script, please ensure the version of the clang-format tool. The CI executes using ubuntu 24.04.
Joel

@joelguittet
Copy link
Owner

Note @pasco1995 if you have not Ubuntu 24.04 just tell me I will check the difference so you can apply it.

@pasco1995
Copy link
Contributor Author

Hi @joelguittet, that would be helpful, thanks.

The current output of the do_code_format.sh script only views the file path and name. Is it possible that it can tell the line number and the conspicuous code formatting as well ?

@joelguittet
Copy link
Owner

@pasco1995 for the modification to apply here is a git diff to do (variables ret and index must be vertically aligned), this will satisfy the verification:

diff --git a/add-ons/inventory/src/mender-inventory.c b/add-ons/inventory/src/mender-inventory.c
index 3378071..e5d456d 100644
--- a/add-ons/inventory/src/mender-inventory.c
+++ b/add-ons/inventory/src/mender-inventory.c
@@ -178,7 +178,7 @@ mender_err_t
 mender_inventory_set_item(char *name, char *value) {
 
     mender_err_t ret;
-    int index;
+    int          index;
 
     /* Take mutex used to protect access to the inventory key-store */
     if (MENDER_OK != (ret = mender_scheduler_mutex_take(mender_inventory_mutex, -1))) {

The current output of the do_code_format.sh script only views the file path and name. Is it possible that it can tell the line number and the conspicuous code formatting as well ?

I will think about that, this could be very helpful yes! I note this in my TODO list :-)

Joel

@pasco1995 pasco1995 force-pushed the feature/extend_inventory_functions branch from ee92a44 to a3f3959 Compare January 5, 2025 14:08
Copy link

sonarqubecloud bot commented Jan 5, 2025

@joelguittet joelguittet merged commit 1b527e3 into joelguittet:master Jan 5, 2025
4 checks passed
@joelguittet
Copy link
Owner

@pasco1995 all good now! Thanks a lot for the job done here and your patience :-) PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants