-
Notifications
You must be signed in to change notification settings - Fork 166
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
[WIP] Added CDN configuration to organizations module #1523
base: develop
Are you sure you want to change the base?
[WIP] Added CDN configuration to organizations module #1523
Conversation
I tried some more tests, but it seems that I probably need some extra logic to resolve the content credential before putting it in the payload the module sends towards Foreman/Satellite. Also, it always changes right now, is that something I missed? Or doesn't the API report these settings back? @evgeni any ideas? :) |
plugins/modules/organization.py
Outdated
# upstream_ca_cert=dict(required=False, type='entity', resource_type='content_credentials', scope=['']), | ||
upstream_ca_cert_id=dict(required=False), |
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.
we really shouldn't require the user to provide an id
, why did the commented code not work? because of the scope?
in other places, we use it like this:
ssl_ca_cert=dict(type='entity', resource_type='content_credentials', scope=['organization']),
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.
Yes, I fully agree, this is just my current 'worked-around' version, and indeed, because of the scope.
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.
@evgeni I think at first I copied that line of code from repository.py
or something like it, but it kept complaining about that the scope couldn't be found :/
|
||
if extra_payload: | ||
payload.update(extra_payload) | ||
module.resource_action('organizations', 'cdn_configuration', payload) |
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.
Do I read it right, this essentially always returns changed=True
now, as there is no way to "diff" the cdn config?!
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.
The data is shown in the API reply to /katello/api/organizations/:id
, so we could diff it… What a mess
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.
I have tried poking around in the API, but I can't find it.
When I go to https://sat.rh.lab/api/organizations/1/cdn_configuration
I get a 404. And it's not listed in the 'overview' at the organizations/<org_id>
endpoint either.
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.
attention attention! katello overrides the org controller!
you need to go to /katello/api/organizations/:id
, not to /api/organizations/:id
, the apipie library will do the right thing for us.
and yes, the cdn_configuration
part is only defined for PUT
(update) operations, you can't GET
it, but the data is part of the normal org show view, if you look at the right controller
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.
I feel my Python-Fu is lacking a bit, but I made an attempt to compare some things, and it seems to work well :-)
This will never be idempotent for network_sync
as the current password cannot be compared with the provided password.
3c2049b
to
a1a7860
Compare
@evgeni ping :-) |
b100239
to
b37a65d
Compare
@evgeni I've rebased my edits and removed the workaroundy hack with the content_credential_id, this is the debug output when running it:
|
4d7d9b1
to
c5aa500
Compare
45eba02
to
458f2a8
Compare
o/ guys,
As mentioned in #1450 , the
foreman_organization
module doesn't do CDN configuration.I took a stab at it and tried to integrate it. It seems to work well, but it's still a WIP, but it seems to function (I only tested 'redhat_cdn' with a different URL and 'export_sync', I still need to set up a secondary test Satellite).
Fire away! I'd love feedback!