On Mon, Nov 24, 2014 at 10:27:18AM -0500, Colin Walters wrote:
I was tracing through this code and trying to understand it while
debugging
https://lists.fedoraproject.org/pipermail/cloud/2014-November/004663.html
---
pyanaconda/network.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
> From 9a9933c3da9845fde27fd148d8781b2c5a00ae83 Mon Sep 17 00:00:00 2001
> From: Colin Walters <walters(a)verbum.org>
> Date: Mon, 24 Nov 2014 09:55:17 -0500
> Subject: [PATCH] network: Add some doc strings
>
I was tracing through this code and trying to understand it while
debugging
https://lists.fedoraproject.org/pipermail/cloud/2014-November/004663.html
---
pyanaconda/network.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
> diff --git a/pyanaconda/network.py b/pyanaconda/network.py
> index 768d465..1d3083a 100644
> --- a/pyanaconda/network.py
> +++ b/pyanaconda/network.py
> @@ -898,6 +898,15 @@ def copyDhclientConfFiles(destPath):
> copyFileToPath(dhclientfile, destPath)
>
> def ks_spec_to_device_name(ksspec=""):
> + """
> + Find the first network device which matches the kickstart specification.
> + Will not match derived types such as bonds and vlans.
> +
> + :param ksspec: kickstart-specified device name
> + :returns: a string naming a physical device, or "" meaning none
matched
> + :rtype: str
> +
> + """
> bootif_mac = ''
> if ksspec == 'bootif' and "BOOTIF" in flags.cmdline:
> bootif_mac = flags.cmdline["BOOTIF"][3:].replace("-",
":").upper()
> @@ -905,7 +914,7 @@ def ks_spec_to_device_name(ksspec=""):
> # "eth0"
> if ksspec == dev:
> break
> - # "link"
> + # "link" - match the first device which is plugged (has a
carrier)
> elif ksspec == 'link':
> try:
> link_up = nm.nm_device_carrier(dev)
> @@ -1054,7 +1063,14 @@ def update_hostname_data(ksdata, hostname):
> nd = hostname_ksdata(hostname)
> ksdata.network.network.append(nd)
>
> -def get_device_name(network_data):
> +def get_device_name(network_data):"""
> + Find the first network device which matches the kickstart specification.
""" should start after the def :)
+
+ :param network_data: The kickstart "network" verb
It is actually a pykickstart NetworkData object.
+ :returns: a string naming a physical device, or ""
meaning none matched
+ :rtype: str
+
+ """
ksspec = network_data.device or flags.cmdline.get('ksdevice') or
""
dev_name = ks_spec_to_device_name(ksspec)
--
1.8.3.1
Looks good other than those, I'll fix it up and push for you.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)