Skip to content

Commit

Permalink
Fixes #38028 - Update smart proxy URI methods for load balancer setups
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz authored and ianballou committed Dec 5, 2024
1 parent fa899c0 commit 02b8079
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/models/katello/concerns/smart_proxy_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -600,12 +604,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

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
Expand Down

0 comments on commit 02b8079

Please sign in to comment.