From cb606f45e3852432787ed895dc55665caa950161 Mon Sep 17 00:00:00 2001 From: Tim Rozet Date: Fri, 8 Sep 2017 16:57:36 -0400 Subject: Migrates clean to python ci/clean.sh will be removed in a future patch after releng is updated to use python. JIRA: APEX-509 JIRA: APEX-319 Change-Id: If890db2fc5a31833ad28ec6f04589e25457bd380 Signed-off-by: Tim Rozet --- apex/common/parsers.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'apex/common/parsers.py') diff --git a/apex/common/parsers.py b/apex/common/parsers.py index 8744c862..91b8905b 100644 --- a/apex/common/parsers.py +++ b/apex/common/parsers.py @@ -71,3 +71,28 @@ def parse_overcloudrc(in_file): logging.debug("os cred not found in: {}".format(line)) return creds + + +def parse_ifcfg_file(in_file): + """ + Parses ifcfg file information + :param in_file: + :return: dictionary of ifcfg key value pairs + """ + ifcfg_params = { + 'IPADDR': '', + 'NETMASK': '', + 'GATEWAY': '', + 'METRIC': '', + 'DNS1': '', + 'DNS2': '', + 'PREFIX': '' + } + with open(in_file, 'r') as fh: + for line in fh: + for param in ifcfg_params.keys(): + match = re.search("^\s*{}=(.*)$".format(param), line) + if match: + ifcfg_params[param] = match.group(1) + break + return ifcfg_params -- cgit 1.2.3-korg