Skip to content

Commit

Permalink
Merge pull request #328 from mchf/bnc940892-lanudevauto-internal-error
Browse files Browse the repository at this point in the history
Bnc940892 lanudevauto internal error
  • Loading branch information
mchf committed Aug 12, 2015
2 parents bfb1448 + c728b01 commit 496577f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 12 deletions.
7 changes: 7 additions & 0 deletions package/yast2-network.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Aug 12 08:31:16 UTC 2015 - mfilka@suse.com

- bnc#940892
- fixed internal error when importing AY profile
- 3.1.112.5

-------------------------------------------------------------------
Fri Jul 31 13:41:08 UTC 2015 - ancor@suse.com

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


Name: yast2-network
Version: 3.1.112.4
Version: 3.1.112.5
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
2 changes: 1 addition & 1 deletion src/clients/lan_auto.rb
Expand Up @@ -92,7 +92,7 @@ def main
# in case keep_install_network is set to true (in AY)
# we'll keep values from installation
# and merge with XML data (bnc#712864)
@param = NetworkAutoYast.instance.merge_configs(@params) if @param["keep_install_network"]
@param = NetworkAutoYast.instance.merge_configs(@param) if @param["keep_install_network"]

@new = FromAY(@param)
Lan.Import(@new)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/LanUdevAuto.rb
Expand Up @@ -184,7 +184,7 @@ def Import(settings)
createUdevFromIfaceName(Ops.get_list(settings, "interfaces", []))
)
else
@udev_rules = Ops.get_list(settings, "net-udev", [])
@udev_rules = settings["net-udev"] || []
end
# if (Arch::s390())
@s390_devices = Ops.get_list(settings, "s390-devices", [])
Expand Down
37 changes: 28 additions & 9 deletions test/lan_udev_auto_test.rb
Expand Up @@ -77,11 +77,11 @@

end

describe "LanUdevAuto#Write" do
ATTR = "ATTR{address}"
VALUE = "aa:BB:cc:DD:ee:FF"
NAME = "custom-name"

ATTR = "ATTR{address}"
VALUE = "aa:BB:cc:DD:ee:FF"
NAME = "custom-name"
describe "LanUdevAuto#Write" do

it "writes MAC in lowercase" do
udev_rules = [
Expand All @@ -105,10 +105,29 @@
.to receive(:Write)
.with(path(".udev_persistent.rules"), ay_rules)
allow(Yast::SCR)
.to receive(:Write)
.and_return 0
.to receive(:Write)
.and_return 0

LanUdevAuto.Import({ "net-udev" => udev_rules })
LanUdevAuto.Write
end
LanUdevAuto.Import({ "net-udev" => udev_rules })
LanUdevAuto.Write
end
end

describe "LanUdevAuto#Import" do
it "imports defined udev rules correctly" do
udev_rules = [
{
"rule" => ATTR,
"value" => VALUE,
"name" => NAME
}
]

expect(LanUdevAuto.Import({ "net-udev" => udev_rules }))
.to be_true
end

it "sucessfully imports data when no udev rule is defined" do
expect(LanUdevAuto.Import({})).to be_true
end
end

0 comments on commit 496577f

Please sign in to comment.