From 1b4b5ed73cd0f2af8d1d920de0b1c2b6665c2cf5 Mon Sep 17 00:00:00 2001 From: "biao716.wang" Date: Thu, 4 May 2023 12:46:01 +0900 Subject: hide credentials information in logs Change-Id: I26a391de6c1e0c18bc9aeff7f31294aad0ada6b6 Signed-off-by: biao716.wang --- createrepomddeps | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/createrepomddeps b/createrepomddeps index 4347005..e183fc0 100755 --- a/createrepomddeps +++ b/createrepomddeps @@ -46,6 +46,12 @@ my $opt_bc; my $opt_zypp; my $cachedir = "/var/cache/build"; +sub hide_passwd { + my $url = shift; + $url =~ s|://[^@]*@|://|; + return $url +} + sub printold { my ($pkg, $baseurl, $old_seen) = @_; @@ -111,8 +117,8 @@ for my $url (@ARGV) { $baseurl .= '/' unless $baseurl =~ /\/$/; if (! -s "${dir}repodata/repomd.xml") { - die("zypp repo $url is not up to date, please refresh first\n") if $opt_zypp; - die("repo $url does not contain a repomd.xml file\n"); + die("zypp repo " . hide_passwd($url) . " is not up to date, please refresh first\n") if $opt_zypp; + die("repo " . hide_passwd($url) . " does not contain a repomd.xml file\n"); } my @primaryfiles; -- cgit v1.2.3