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

Fix Katello product resource API call #142

Merged
merged 7 commits into from
Jan 29, 2024

Conversation

bitkeks
Copy link
Collaborator

@bitkeks bitkeks commented Nov 28, 2023

foreman_katello_product used an old wrapper that did not include location_id and organization_id in the payload of calls towards the API.

Resolves #54

foreman_katello_product used an old wrapper that did not include
location_id and organization_id in the payload of calls towards the API.

Resolves terraform-coop#54

Signed-off-by: Dominik Pataky <pataky@mindful-security.eu>
On the way to fix the creation, modification and deletion of Katello
products, it turned out that Katello uses async responses in its API.
Specifically, the destroy (DELETE) endpoints return an async task, which
must be checked for completion. This check is now implemented. If a
product is destroyed, the API client detects the usage of foreman_tasks
and invokes a routine to check the task by its ID, waiting for it to
finish.

Signed-off-by: Dominik Pataky <pataky@mindful-security.eu>
Signed-off-by: Dominik Pataky <pataky@mindful-security.eu>
As seen in
https://apidocs.theforeman.org/katello/latest/apidoc/v2/products.html,
the organization_id is a required parameter for the GET endpoint. It is
now sent with the name query term.

Signed-off-by: Dominik Pataky <pataky@mindful-security.eu>
Signed-off-by: Dominik Pataky <pataky@mindful-security.eu>
@bitkeks bitkeks marked this pull request as ready for review December 11, 2023 08:40
@bitkeks bitkeks requested a review from lhw December 11, 2023 08:41
@bitkeks
Copy link
Collaborator Author

bitkeks commented Dec 11, 2023

This one's ready for its purpose to fix the katello product resource calls. It also adds handling for the async "ForemanTask" objects, which are the return type in the Katello API.

To not further bloat this PR, I will continue on another branch for #141

@bitkeks bitkeks self-assigned this Dec 18, 2023
@bitkeks
Copy link
Collaborator Author

bitkeks commented Dec 19, 2023

@lhw would you like me to split the PR into two separate PRs, one containing the fix for katello_product and the other for the Katello async ForemanTasks?

Signed-off-by: Dominik Pataky <pataky@mindful-security.eu>
Copy link
Contributor

@lhw lhw left a comment

Choose a reason for hiding this comment

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

No. It's fine. Terraform can't really do async by nature. So waiting for a response to a started task is the right way to handle it.

@lukry59
Copy link

lukry59 commented Jan 29, 2024

Hello,

Any news on the progress of this PR ?

Regards,
G.

@bitkeks bitkeks merged commit f92a79f into terraform-coop:master Jan 29, 2024
7 checks passed
@bitkeks
Copy link
Collaborator Author

bitkeks commented Jan 29, 2024

Merged, had no conflicts - feel free to test in your environment @lukry59 !

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.

foreman_katello_product is broken
3 participants