Skip to content

Commit

Permalink
Filter UpdateRepository URLs in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Feb 14, 2017
1 parent a9bacdb commit 75c903f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lib/installation/update_repository.rb
Expand Up @@ -16,6 +16,10 @@
require "pathname"
require "fileutils"

Yast.import "Pkg"
Yast.import "Progress"
Yast.import "URL"

module Installation
# Represents a update repository to be used during self-update
# (check doc/SELF_UPDATE.md for details).
Expand Down Expand Up @@ -109,9 +113,6 @@ class CouldNotSquashPackage < FetchError; end
# @param uri [URI] Repository URI
# @param origin [Symbol] Repository origin (@see ORIGINS)
def initialize(uri, origin = :default)
Yast.import "Pkg"
Yast.import "Progress"

textdomain "installation"

@uri = uri
Expand Down Expand Up @@ -257,6 +258,14 @@ def remote?
Yast::Pkg.UrlSchemeIsRemote(uri.scheme)
end

# Redefines the inspect method to avoid logging passwords
#
# @return [String] Debugging information
def inspect
safe_url = Yast::URL.HidePassword(uri.to_s)
"#<Installation::UpdateRepository> @uri=\"#{safe_url}\" @origin=#{@origin.inspect}"
end

private

# Fetch and build a squashfs filesytem for a given package
Expand Down

0 comments on commit 75c903f

Please sign in to comment.