Skip to content

Commit

Permalink
Merge e0ad6aa into 3510e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
wfeldt committed Dec 5, 2018
2 parents 3510e2e + e0ad6aa commit 1afbad3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
18 changes: 10 additions & 8 deletions src/modules/InstURL.rb
Expand Up @@ -132,6 +132,9 @@ def RewriteCDUrl(url)
end

# Convert install.inf to a URL useable by the package manager
#
# Return an empty string if no repository URL has been defined.
#
# @param [String] extra_dir append path to original URL
# @return [String] new repository URL
def installInf2Url(extra_dir = "")
Expand All @@ -140,16 +143,15 @@ def installInf2Url(extra_dir = "")
@installInf2Url = Linuxrc.InstallInf("ZyppRepoURL")

if @installInf2Url.to_s.empty?
# Make it compatible with the current behaviour when
# install.inf does not exist.
log.warn "No URL specified through ZyppRepoURL"
@installInf2Url = "cd:///"
# no fallback URL any more
log.info "No install URL specified through ZyppRepoURL"
@installInf2Url = ""
else
# The URL is parsed/built only if needed to avoid potential problems with corner cases.
@installInf2Url = add_extra_dir_to_url(@installInf2Url, extra_dir) unless extra_dir.empty?
@installInf2Url = add_ssl_verify_no_to_url(@installInf2Url) unless SSLVerificationEnabled()
end

# The URL is parsed/build only if needed to avoid potential problems with corner cases.
@installInf2Url = add_extra_dir_to_url(@installInf2Url, extra_dir) unless extra_dir.empty?
@installInf2Url = add_ssl_verify_no_to_url(@installInf2Url) unless SSLVerificationEnabled()

log.info "Using install URL: #{URL.HidePassword(@installInf2Url)}"
@installInf2Url
end
Expand Down
4 changes: 2 additions & 2 deletions test/inst_url_test.rb
Expand Up @@ -29,8 +29,8 @@
context "when ZyppRepoURL is not defined" do
let(:zypp_repo_url) { nil }

it "returns cd:///" do
expect(inst_url.installInf2Url("")).to eq("cd:///")
it "returns an empty string" do
expect(inst_url.installInf2Url("")).to eq("")
end
end

Expand Down

0 comments on commit 1afbad3

Please sign in to comment.