Skip to content

Commit

Permalink
Merge branch 'Code-11-SP3' into Code-11-SP4
Browse files Browse the repository at this point in the history
Conflicts:
	VERSION
	package/yast2-network.changes
  • Loading branch information
mchf committed May 13, 2015
2 parents 3ee7b04 + 13127c5 commit 572cf56
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.17.203
2.17.204
8 changes: 8 additions & 0 deletions package/yast2-network.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue May 12 19:13:46 UTC 2015 - mfilka@suse.com

- bnc#874259
- keep device configuration provided via linuxrc when autoyast
keep_install_network is set
- 2.17.204

-------------------------------------------------------------------
Mon Jan 19 08:07:42 UTC 2015 - mfilka@suse.com

Expand Down
80 changes: 70 additions & 10 deletions src/clients/lan_auto.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,65 @@ map UpcaseCondSet (map ret, map m, string key) {
return ret;
}

/**
* Merges two devices map into one.
*
* Maps are expected in NetworkInterfaces format. That is
* $[
* type1:
* $[
* dev_name_1: $[ ... ],
* ...
* ],
* ...
* ]
*
* If a device definition is present in both maps, then the one from devices2
* wins.
*
* @param in_devs1 first map of devices in NetworkInterfaces format
* @param in_devs2 second map of devices in NetworkInterfaces format
*
* @return merged device map in NetworkInterfaces format or empty map
*/
define map MergeDevices(map<string, any> in_devs1, map<string, any> in_devs2)
{
map merged_devices = $[];

y2milestone("MergeDevices: start (in_devs1: %1, in_devs2: %2)", in_devs1, in_devs2);

if(IsEmpty(in_devs1))
{
merged_devices = in_devs2 == nil ? $[] : in_devs2;
return merged_devices;
}
if(IsEmpty(in_devs2))
{
merged_devices = in_devs1;
return merged_devices;
}

merged_devices = in_devs1;

y2milestone("MergeDevices: going to do real merge");

foreach(string type, any devices, in_devs2,
{
if(haskey(in_devs1, type))
{
map merged = union((map) in_devs1[type]:$[], (map) in_devs2[type]:$[]);
merged_devices[type] = merged;
}
else
{
merged_devices = add(in_devs1, type, devices);
}
});

y2milestone("MergeDevices: result %1", merged_devices);

return merged_devices;
}

/**
* Convert data from autoyast to structure used by module.
Expand Down Expand Up @@ -127,7 +186,6 @@ define map FromAY(map input)
foreach(string devname, map if_data, interfaces, {

string type = NetworkInterfaces::GetType(devname);
// string id = NetworkInterfaces::device_num (devname);
map d = devices[type]:$[];
d[devname] = if_data;
devices[type] = d;
Expand All @@ -136,8 +194,6 @@ define map FromAY(map input)
map hwcfg = $[];
if (size(input["modules"]:[]) > 0)
{
// "hwcfg":$["bus-pci-0000:02:05.0":$["MODULE":"sk98lin",
// "MODULE_OPTIONS":"", "STARTMODE":"auto"]]
hwcfg = listmap(map mod, input["modules"]:[], {
string options = mod["options"]:"";
string module_name = mod["module"]:"";
Expand All @@ -152,8 +208,9 @@ define map FromAY(map input)
});
}


input["devices"] = devices;
// merge devices definitions obtained from inst-sys (input["devices"])
// and those which were read from AY profile. bnc#874259
input["devices"] = MergeDevices((map<string, any>) input["devices"]:$[], devices);
input["hwcfg"] = hwcfg;

// DHCP:: config: some of it is in the DNS part of the profile
Expand All @@ -163,7 +220,7 @@ define map FromAY(map input)

if (haskey(dns, "dhcp_hostname"))
dhcp["DHCLIENT_SET_HOSTNAME"] = dns["dhcp_hostname"]:false;

dhcp = UpcaseCondSet (dhcp, dhcpopts, "dhclient_client_id");
dhcp = UpcaseCondSet (dhcp, dhcpopts, "dhclient_additional_options");
dhcp = UpcaseCondSet (dhcp, dhcpopts, "dhclient_hostname_option");
Expand Down Expand Up @@ -307,17 +364,17 @@ else if(func == "Import") {
// bnc#796580 The problem with this is that due to compatibility with
// older profiles, a missing element may have a different meaning than
// "use what the filesystem/kernel currently uses".
// In particular, a missing write_hostname [1] means
// In particular, a missing write_hostname means
// "use the product default from DVD1/control.xml".
// Other elements may have similar problems,
// to be fixed post-PTF for maintenance.
if (! haskey(param, "dns")) {
param["dns"] = $[];
}
foreach( string key, any value, dns, {
foreach( string key, any value, dns,
{
if( ! haskey( param["dns"]:$[], key )
&& key != "write_hostname" ) { // [1] ^
&& key != "write_hostname" ) {
y2milestone("(dns) taking %1 from inst-sys. Value = %2", key, value);
param["dns",key] = value;
}
Expand All @@ -331,6 +388,9 @@ else if(func == "Import") {
y2milestone("(routing) taking %1 from inst-sys. Value = %2", key, value);
}
});

// store device configuration from inst-sys, bnc#874259
param["devices"] = from_system["devices"]:nil;
}
map new = FromAY(param);
Lan::Import(new);
Expand Down

0 comments on commit 572cf56

Please sign in to comment.