Skip to content

Commit

Permalink
Merge b3416ab into 3f701be
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidner committed Jun 12, 2015
2 parents 3f701be + b3416ab commit b291e38
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 43 deletions.
7 changes: 7 additions & 0 deletions package/yast2-proxy.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jun 11 12:01:30 UTC 2015 - mvidner@suse.com

- Fixed the last change not to crash with "internal error in
WriteCurlrc" when installing with a proxy (boo#929868).
- 3.1.2.2

-------------------------------------------------------------------
Thu Apr 9 15:35:53 UTC 2015 - mvidner@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-proxy.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-proxy
Version: 3.1.2.1
Version: 3.1.2.2
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
4 changes: 0 additions & 4 deletions src/include/proxy/dialogs.rb
Expand Up @@ -536,7 +536,6 @@ def ProxyMainDialog(standalone)
HSpacing(5)
)

# if(standalone == true)
Wizard.SetContentsButtons(
caption,
contents,
Expand All @@ -547,9 +546,6 @@ def ProxyMainDialog(standalone)
Wizard.SetNextButton(:next, Label.OKButton)
Wizard.SetAbortButton(:abort, Label.CancelButton)
Wizard.HideBackButton
# else
# Wizard::SetContentsButtons(caption, contents, help,
# Label::BackButton(), Label::OKButton());

# #103841, relaxed. now avoiding only quotes
# #337048 allow using space as well
Expand Down
43 changes: 5 additions & 38 deletions src/modules/Proxy.rb
@@ -1,17 +1,10 @@
# encoding: utf-8

# File: modules/Proxy.ycp
# Package: Network configuration
# Summary: Proxy data
# Authors: Michal Svec <msvec@suse.cz>
#
# $Id$
#
# Configures FTP and HTTP proxies via sysconfig & SuSEconfig
# and /root/.curlrc (for YOU)
require "yast"

module Yast
# Configures FTP and HTTP proxies via sysconfig
# and /root/.curlrc (for YOU)
class ProxyClass < Module
def main
textdomain "proxy"
Expand Down Expand Up @@ -107,13 +100,6 @@ def Read
end
end

# Read /root/.wgetrc
# YOU uses curl(1)
# user = SCR::Read(.root.wgetrc.proxy_user);
# if(user == nil) user = "";
# pass = SCR::Read(.root.wgetrc.proxy_passwd);
# if(pass == nil) pass = "";

true
end

Expand All @@ -136,9 +122,9 @@ def EscapeForCurlrc(s)

def WriteCurlrc
proxyuser = nil
if @user != ""
if @user && !@user.empty?
proxyuser = @user
proxyuser = @user + ":" + @pass if @pass != ""
proxyuser << ":" << @pass if @pass && !@pass.empty?
end

options = {
Expand Down Expand Up @@ -207,12 +193,6 @@ def Write
#user can't relogin in installation and update, do not show the msg then (bnc#486037, bnc#543469)
ProxyFinishPopup(true) if Mode.normal

# Update /root/.wgetrc
# YOU uses curl(1)
# SCR::Write(.root.wgetrc.proxy_user, user);
# SCR::Write(.root.wgetrc.proxy_passwd, pass);
# SCR::Write(.root.wgetrc, nil);

@modified = false

true
Expand Down Expand Up @@ -470,20 +450,7 @@ def Summary
""
)
)
]

# Summary text * /
# Summary::Device(sformat(_("No Proxy Domains: %1"), no) + "\n<br>" +
# "<p>" + ( user == "" ?
# /* Summary text * /
# _("Proxy user name is not set.") :
# /* Summary text * /
# sformat(_("Proxy User Name: %1"), user)) +
# "<br>" + ( pass == "" ?
# /* Summary text * /
# _("Proxy password is not set.") :
# /* Summary text * /
# _("Proxy password is set.")) ];
]
end

Summary.DevicesList(ret)
Expand Down
29 changes: 29 additions & 0 deletions test/write_test.rb
Expand Up @@ -48,6 +48,35 @@
expect(subject.WriteCurlrc).to be true
end

it "writes proxy settings, and a comment, when proxy is enabled via InstallInfConvertor" do
subject.Import({ "enabled" => true,
"http_proxy" => "proxy.example.org:3128",
"proxy_user" => nil,
"proxy_password" => nil })

expect(Yast::SCR).to receive(:Write).
with(path_matching(/^\.root\.curlrc\..*\."comment"/), /Changed/).
once.and_return true

expect(Yast::SCR).to receive(:Write).
with(path(".root.curlrc.\"--proxy\""), "proxy.example.org:3128").
once.and_return true

expect(Yast::SCR).to receive(:Write).
with(path(".root.curlrc.\"--noproxy\""), "localhost").
once.and_return true

allow(Yast::SCR).to receive(:Write).
with(path_matching(/^\.root\.curlrc/), nil).
and_return true

expect(Yast::SCR).to receive(:Write).
with(path(".root.curlrc"), nil).
once.and_return true

expect(subject.WriteCurlrc).to be true
end

it "writes a no-proxy setting" do
subject.Import({ "enabled" => true,
"http_proxy" => "proxy.example.org:3128",
Expand Down

0 comments on commit b291e38

Please sign in to comment.