Skip to content

Commit

Permalink
Merge pull request #639 from yast/do_not_remove_network
Browse files Browse the repository at this point in the history
Do not remove interfaces configuration when network section is absent
  • Loading branch information
teclator committed Jul 7, 2020
2 parents 44a79e8 + ef9a0e1 commit cceb533
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 64 deletions.
7 changes: 7 additions & 0 deletions package/autoyast2.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jul 7 13:20:24 UTC 2020 - Knut Anderssen <kanderssen@suse.com>

- Do not remove interfaces configuration by default when there is
not networking section defined in the profile (bsc#1173793)
- 4.2.39

-------------------------------------------------------------------
Fri Jun 12 13:15:42 UTC 2020 - Knut Anderssen <kanderssen@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/autoyast2.spec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
%endif

Name: autoyast2
Version: 4.2.38
Version: 4.2.39
Release: 0
Summary: YaST2 - Automated Installation
License: GPL-2.0-only
Expand Down
63 changes: 0 additions & 63 deletions src/clients/inst_autoconfigure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,6 @@ def main
Ops.get_string(d, "res", "")
end)

# keep network on AutoYaST ugprade
if !Mode.autoupgrade
if !Builtins.haskey(Profile.current, "networking")
removeNetwork([]) # no networking section -> no network
elsif Ops.get_boolean(
Profile.current,
["networking", "keep_install_network"],
true
) == false
removeNetwork(
Ops.get_list(Profile.current, ["networking", "interfaces"], [])
) # networking section without keeping the install network
end
end

Builtins.foreach(@deps) do |r|
p = Ops.get_string(r, "res", "")
d = Ops.get_map(r, "data", {})
Expand Down Expand Up @@ -417,54 +402,6 @@ def MatchInterface(id)
ret
end

def removeNetwork(ilist)
ilist = deep_copy(ilist)
Yast.import "NetworkInterfaces"
Builtins.y2milestone("removeNetwork ifaces:%1", ilist)
ilist = Builtins.maplist(ilist) do |i|
if Builtins.substring(Ops.get_string(i, "device", ""), 0, 7) == "eth-id-"
Ops.set(i, "device", MatchInterface(Ops.get_string(i, "device", "")))
end
deep_copy(i)
end
Builtins.y2milestone("removeNetwork ifaces:%1", ilist)
l = SCR.Read(path(".target.dir"), ["/etc/sysconfig/network", []])
netlist = []
Builtins.y2milestone("removeNetwork list:%1", l)
Builtins.foreach(
Convert.convert(l, from: "any", to: "list <string>")
) do |s|
if Builtins.issubstring(s, "ifcfg-") &&
!Builtins.issubstring(s, "ifcfg-lo")
if Builtins.substring(s, 0, 6) == "ifcfg-" && s != "ifcfg-lo"
net = Builtins.substring(s, 6)
tmp = Builtins.filter(ilist) do |l2|
Ops.get_string(l2, "device", "") == net
end
if Builtins.isempty(tmp)
Builtins.y2milestone("removeNetwork net:%1", net)
NetworkInterfaces.Delete(net)
netlist = Builtins.add(netlist, net)
Builtins.y2milestone(
"removing installation network: /etc/sysconfig/network/%1",
s
)
SCR.Execute(
path(".target.remove"),
Builtins.sformat("/etc/sysconfig/network/%1", s)
)
end
end
end
end
Builtins.y2milestone("removeNetwork netlist:%1", netlist)
if !Builtins.isempty(netlist)
NetworkInterfaces.Commit
# NetworkInterfaces::Write( ".*" );
end
nil
end

def processWait(resource, stage)
Builtins.foreach(
Ops.get_list(Profile.current, ["general", "wait", stage], [])
Expand Down

0 comments on commit cceb533

Please sign in to comment.