Skip to content

Commit

Permalink
Merge pull request #1079 from yast/bsc-1172922-master
Browse files Browse the repository at this point in the history
Merge bsc#1172922 fix into master
  • Loading branch information
imobachgs committed Jun 15, 2020
2 parents 6f4990e + a22efc7 commit 7a9507d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
7 changes: 7 additions & 0 deletions package/yast2-network.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Jun 15 11:53:03 UTC 2020 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Do not export interfaces <aliases> section when there are no
aliases to export (bsc#1172922).
- 4.3.6

-------------------------------------------------------------------
Thu Jun 11 08:24:34 UTC 2020 - Knut Anderssen <kanderssen@suse.com>

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


Name: yast2-network
Version: 4.3.5
Version: 4.3.6
Release: 0
Summary: YaST2 - Network Configuration
License: GPL-2.0-only
Expand Down
7 changes: 7 additions & 0 deletions src/lib/y2network/autoinst_profile/interface_section.rb
Expand Up @@ -332,6 +332,13 @@ def init_from_config(config)
true
end

# @see SectionWithAttributes#to_hashes
def to_hashes
hash = super
hash.delete("aliases") if hash.key?("aliases") && hash["aliases"].empty?
hash
end

# Helper to get wireless keys as array
# @return [Array<String>]
def wireless_keys
Expand Down
23 changes: 23 additions & 0 deletions test/y2network/autoinst_profile/interface_section_test.rb
Expand Up @@ -74,6 +74,29 @@
end
end

describe "#to_hashes" do
subject(:section) do
described_class.new_from_hashes(
"device" => "eth0",
"aliases" => { "alias0" => { "IPADDR" => "10.100.0.1", "PREFIXLEN" => "24" } }
)
end

it "exports the aliases key" do
expect(section.to_hashes["aliases"]).to eq(section.aliases)
end

context "when the list of aliases is empty" do
subject(:section) do
described_class.new_from_hashes("device" => "eth0", "aliases" => {})
end

it "does not export the aliases key" do
expect(section.to_hashes).to_not have_key("aliases")
end
end
end

describe "#wireless_keys" do
it "returns array" do
section = described_class.new_from_hashes({})
Expand Down

0 comments on commit 7a9507d

Please sign in to comment.