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

Do not add service credential url paramter if not necessary #1076

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/controllers/services_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ def show

builder = Builder::XmlMarkup.new
service_xml = builder.repoindex(ttl: ZYPPER_SERVICE_TTL) do
# NOTE: We only care to add the ?credentials parameter to the repository URL if
# we are *NOT* dealing with plain RMT but the authentication engine of Public Cloud.
# The engine requires to supply the service name to function properly, since repositories
# are authenticated in this case.
service_name = defined?(StrictAuthentication::Engine) ? service.name : nil

repos.each do |repo|
attributes = {
url: make_repo_url(request.base_url, repo.local_path, service.name),
url: make_repo_url(request.base_url, repo.local_path, service_name),
alias: repo.name,
name: repo.name,
autorefresh: repo.autorefresh,
Expand Down
3 changes: 3 additions & 0 deletions lib/rmt/misc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ module RMT
module Misc
def self.make_repo_url(base_url, local_path, service_name = nil)
uri = URI.join(base_url, File.join(RMT::DEFAULT_MIRROR_URL_PREFIX, local_path))
# NOTE: Make sure to only add the credentials where necessary (Pubcloud? or SMT?)
# In all other cases do not add them, since this will break other repository
# managers such as yum!
felixsch marked this conversation as resolved.
Show resolved Hide resolved
uri.query = "credentials=#{service_name}" if service_name
uri.to_s
end
Expand Down
3 changes: 2 additions & 1 deletion package/obs/rmt-server.changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-------------------------------------------------------------------
Wed Oct 04 13:23:00 UTC 2023 - Felix Schnizlein <[email protected]>
Thu Jan 25 17:40:00 UTC 2024 - Felix Schnizlein <[email protected]>

- Version 2.15:
* Moving system hardware information to systems database table to
Expand All @@ -8,6 +8,7 @@ Wed Oct 04 13:23:00 UTC 2023 - Felix Schnizlein <[email protected]>
* rmt-client-setup-res script: fix for CentOS8 clients (bsc#1214709)
* Updated supportconfig script (bsc#1216389)
* Support zstd compression for repository metadata (bsc#1218775)
* Do not add credential handling to normal repository URLs (#1219153)

-------------------------------------------------------------------
Thu Jun 06 15:44:00 UTC 2023 - Luís Caparroz <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/services_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

let(:model_urls) do
service.repositories.reject(&:installer_updates).map do |repo|
RMT::Misc.make_repo_url('http://www.example.com', repo.local_path, service.name)
RMT::Misc.make_repo_url('http://www.example.com', repo.local_path)
end
end

Expand Down
Loading