[OE-core] [PATCH] oeqa.utils.metadata: cope with invalid lines in os-release file
Markus Lehtonen
markus.lehtonen at linux.intel.com
Wed Apr 26 14:39:42 UTC 2017
Don't crash if every line in /etc/os-release does not adhere to the
expected "key=val" format. E.g. CentOS 7 has empty lines in the file.
Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
---
meta/lib/oeqa/utils/metadata.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/meta/lib/oeqa/utils/metadata.py b/meta/lib/oeqa/utils/metadata.py
index cb81155e54..d291ddb960 100644
--- a/meta/lib/oeqa/utils/metadata.py
+++ b/meta/lib/oeqa/utils/metadata.py
@@ -20,8 +20,10 @@ def get_os_release():
return None
with open(os_release_file) as fobj:
for line in fobj:
- key, value = line.split('=', 1)
- data[key.strip().lower()] = value.strip().strip('"')
+ split = line.split('=', 1)
+ if len(split) == 2:
+ key, value = split
+ data[key.strip().lower()] = value.strip().strip('"')
return data
def metadata_from_bb():
--
2.12.0
More information about the Openembedded-core
mailing list