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

feat: added support for container state in inventory API #4221

Conversation

GregoryIvo
Copy link
Contributor

Note: We are using the Conventional Commits convention for our pull request titles. Please take a look at the PR title format document for the supported types and scopes.

Brief description of the PR. [e.g. Added null check on object to avoid NullPointerException]

Related Issue: This PR fixes/closes {issue number}

Description of the solution adopted: A more detailed description of the changes made to solve/close one or more issues. If the PR is simple and easy to inderstand this section can be skipped.

Screenshots: If applicable, add screenshots to help explain your solution

Any side note on the changes made: Description of any other change that has been made, which is not directly linked to the issue resolution [e.g. Code clean up/Sonar issue resolution]

@GregoryIvo
Copy link
Contributor Author

GregoryIvo commented Nov 9, 2022

note for review.

I decided to not include the container state in the un-marshaler.

  1. When a container is un-marshalled, Kura will use the name to query locally for the container and populate its own fields
  2. the mapping of the container state, to Kura bundle state is not symmetrical, so we cannot trust the un marshed state

@GregoryIvo
Copy link
Contributor Author

GregoryIvo commented Nov 9, 2022

Inventory Get Container Request:
image

Returned Container String:

eyJjb250YWluZXJzIjpbeyJuYW1lIjoiTWFuYWdlZENvbnRhaW5lcjEiLCJ2ZXJzaW9uIjoibmdpbng6bGF0ZXN0IiwidHlwZSI6IkRPQ0tFUiIsInN0YXRlIjoiYWN0aXZlIn0seyJuYW1lIjoibmdpbngiLCJ2ZXJzaW9uIjoibmdpbng6bGF0ZXN0IiwidHlwZSI6IkRPQ0tFUiIsInN0YXRlIjoidW5pbnN0YWxsZWQifSx7Im5hbWUiOiIxLXRlc3QiLCJ2ZXJzaW9uIjoibmdpbng6bGF0ZXN0IiwidHlwZSI6IkRPQ0tFUiIsInN0YXRlIjoidW5pbnN0YWxsZWQifV19

Converted String:

{"containers":[{"name":"ManagedContainer1","version":"nginx:latest","type":"DOCKER","state":"active"},{"name":"nginx","version":"nginx:latest","type":"DOCKER","state":"uninstalled"},{"name":"1-test","version":"nginx:latest","type":"DOCKER","state":"uninstalled"}]}

@GregoryIvo
Copy link
Contributor Author

Inventory EXEC (Stop Container Request):
image

Base64 String:

eyJuYW1lIjoiTWFuYWdlZENvbnRhaW5lcjEiLCJ2ZXJzaW9uIjoibmdpbng6bGF0ZXN0IiwidHlwZSI6IkRPQ0tFUiIsInN0YXRlIjoiYWN0aXZlIn0=

Decoded String:

{"name":"ManagedContainer1","version":"nginx:latest","type":"DOCKER","state":"active"}

@GregoryIvo
Copy link
Contributor Author

Reviewer Note:
These changes still work with the current version of kapua. (Start and stop still work!)

image

@GregoryIvo GregoryIvo marked this pull request as ready for review November 9, 2022 21:17
@GregoryIvo GregoryIvo changed the title feat: added (un)marshaller support for container state feat: added support for container state in inventory API Nov 10, 2022
@pierantoniomerlino pierantoniomerlino merged commit 523716e into eclipse-kura:develop Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants