-
Notifications
You must be signed in to change notification settings - Fork 297
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
Fixes #38028 - Update smart proxy URI methods for load balancer setups #11229
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,9 +131,13 @@ def alternate_content_sources | |
SmartProxy.joins(:smart_proxy_alternate_content_sources).where('katello_smart_proxy_alternate_content_sources.smart_proxy_id' => self.id) | ||
end | ||
|
||
def registration_host | ||
def registration_url | ||
url = self.setting('Registration', 'registration_url').presence || self.url | ||
URI.parse(url).host | ||
URI(url) | ||
end | ||
|
||
def registration_host | ||
registration_url.host | ||
end | ||
|
||
def load_balanced? | ||
|
@@ -598,12 +602,16 @@ def pulp_content_url | |
URI(setting(SmartProxy::PULP3_FEATURE, 'content_app_url')) | ||
end | ||
|
||
def load_balancer_pulp_content_url | ||
URI::HTTPS.build(host: registration_url.host, path: pulp_content_url.path) | ||
end | ||
Comment on lines
602
to
+607
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hopefully There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ianballou Would this url be different for a smart proxy that uses an external Pulp? Is that setup supported with load balanced smart proxies? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should be able to rely on the path always being |
||
|
||
def audit_capsule_sync | ||
write_audit(action: "sync capsule", comment: _('Successfully synced capsule.'), audited_changes: {}) | ||
end | ||
|
||
class ::SmartProxy::Jail < ::Safemode::Jail | ||
allow :rhsm_url, :pulp_content_url | ||
allow :rhsm_url, :pulp_content_url, :load_balancer_pulp_content_url, :registration_url | ||
end | ||
end | ||
end | ||
|
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 added the bare
registration_url
method here so that Foreman can do things to theURI
object it returns, directly (e.g. using itspath
andport
).