[PATCH rhel7-branch] network kickstart: add support for devices configured in %pre (#1019796)
Vratislav Podzimek
vpodzime at redhat.com
Mon Oct 21 12:40:20 UTC 2013
On Fri, 2013-10-18 at 13:45 +0200, Radek Vykydal wrote:
> Resolves: rhbz#1019796
>
> Eg %include configuration creted dynamically in %pre
> ---
> pyanaconda/network.py | 264 +++++++++++++++++++++++++++++++++++++++-----------
> pyanaconda/nm.py | 114 +++++++++++++++++++---
> 2 files changed, 309 insertions(+), 69 deletions(-)
>
> diff --git a/pyanaconda/network.py b/pyanaconda/network.py
> index 79f609f..ef50a27 100644
> --- a/pyanaconda/network.py
> +++ b/pyanaconda/network.py
> @@ -34,6 +34,7 @@ import tempfile
> import simpleconfig
> import re
> import IPy
> +import uuid
> from flags import flags
> import itertools
>
> @@ -216,10 +217,11 @@ def _ifcfg_files(directory):
> def logIfcfgFiles(message=""):
> ifcfglog.debug("content of files (%s):" % message)
> for path in _ifcfg_files(netscriptsDir):
> + ifcfglog.debug("%s:" % path)
> with open(path, "r") as f:
> - content = f.read()
> - ifcfglog.debug("%s:\n%s" % (path, content))
> -
> + for line in f.readlines():
> + ifcfglog.debug(" %s" % line.strip())
> + ifcfglog.debug("all settings: %s" % nm.nm_get_all_settings())
You can use 'for line in f:'.
> +
> + ifcfg_path = find_ifcfg_file_of_device(dev_name)
> + # if the device was already configured in intramfs by kickstart ignore it
> + if ifcfg_path:
> + with open(ifcfg_path, 'r') as f:
> + if "parse-kickstart" in f.read():
I think using "Generated by parse-kickstart" or something like that may
make the code clearer.
Apart from these two comments this looks good to me.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list