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

Add an API to compare inventory components #130

Closed
wants to merge 1 commit into from

Conversation

Alva8756
Copy link
Contributor

@Alva8756 Alva8756 commented Feb 7, 2025

Users can use it to:

  • compare component gaps between EMAPI and FleetDB
  • check if a server data has gaps in FleetDB.

Comment on lines +159 to +163
// /inventory/compare
srvInventoryCompare := srvInventory.Group("/compare")
{
srvInventoryCompare.POST("/:uuid", amw.AuthRequired(readScopes("server")), r.compareInventory)
}
Copy link

@coffeefreak101 coffeefreak101 Feb 7, 2025

Choose a reason for hiding this comment

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

If I understand this correctly, a user has to POST some JSON of a server to /inventory/compare/{uuid} and fleetdb will compare that JSON with what is in the database, right? And we plan on using this to see if some data is out of sync with EMAPI?

I think the API would be easier to use if fleetdb did the work of getting the server JSON directly from EMAPI, instead of requiring the user to post the data. Then, you could just make this a GET request. It really shouldn't be a POST anyway. POST is meant for creating a resource, and nothing really gets created here. Would it be possible for fleetdb to get the inventory from EMAPI?

Also, it would be more RESTful to make the route /inventory/{uuid}/compare.

Copy link
Contributor Author

@Alva8756 Alva8756 Feb 10, 2025

Choose a reason for hiding this comment

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

Thanks John,
I realized Vince mentioned it's not good to let FleetDB depends on EMAPI as it will expand the dependency/binary size.
It looks it's more appropriate to move the function to the mctl as a tool. I will close this PR for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the PR to metal-toolbox/mctl#168

@Alva8756 Alva8756 closed this Feb 10, 2025
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