[PATCH rhel7-branch] network: on rhel don't assume autoconnections created by NM (#1196721)
Jiří Konečný
jkonecny at redhat.com
Fri Jun 5 09:10:43 UTC 2015
On Fri, 2015-06-05 at 10:08 +0200, Radek Vykydal wrote:
> The behaviour is different on rhel and fedora. We have NM configured
> to
> no-auto-default=* on RHEL.
>
> Related: rhbz#1196721
> ---
> pyanaconda/network.py | 29 ++++++++---------------------
> 1 file changed, 8 insertions(+), 21 deletions(-)
>
> diff --git a/pyanaconda/network.py b/pyanaconda/network.py
> index 6aefbf3..079946d 100644
> --- a/pyanaconda/network.py
> +++ b/pyanaconda/network.py
> @@ -261,38 +261,25 @@ class IfcfgFile(SimpleConfigFile):
> def dumpMissingDefaultIfcfgs():
> """
> Dump missing default ifcfg file for wired devices.
> - For default auto connections created by NM upon start - which
> happens
> - in case of missing ifcfg file - rename the connection using
> device name
> - and dump its ifcfg file. (For server, default auto connections
> will
> - be turned off in NetworkManager.conf.)
> - The connection id (and consequently ifcfg file) is set to device
> name.
> Returns list of devices for which ifcfg file was dumped.
> -
> """
> rv = []
>
> for devname in nm.nm_devices():
> - # for each ethernet device
> - # FIXME add more types (infiniband, bond...?)
> if not nm.nm_device_type_is_ethernet(devname):
> continue
>
> - # check that device has connection without ifcfg file
> try:
> nm.nm_device_setting_value(devname, "connection",
> "uuid")
> except nm.SettingsNotFoundError:
> - continue
> - if find_ifcfg_file_of_device(devname):
> - continue
> -
> - try:
> - nm.nm_update_settings_of_device(devname, [['connection',
> 'id', devname, None]])
> - log.debug("network: dumping ifcfg file for default
> autoconnection on %s", devname)
> - nm.nm_update_settings_of_device(devname, [['connection',
> 'autoconnect', False, None]])
> - log.debug("network: setting autoconnect of %s to False"
> , devname)
> - except nm.SettingsNotFoundError:
> - log.debug("network: no ifcfg file for %s", devname)
> - rv.append(devname)
> + if find_ifcfg_file_of_device(devname):
> + continue
> + from pyanaconda.kickstart import AnacondaKSHandler
> + handler = AnacondaKSHandler()
> + # pylint: disable=E1101
> + network_data = handler.NetworkData(onboot=False,
> ipv6="auto")
> + add_connection_for_ksdata(network_data, devname)
> + rv.append(devname)
>
> return rv
>
It seems ok for me.
Ack.
More information about the anaconda-patches
mailing list