From 178fb5fe5f84de2efb72df348408f238378f1ffa Mon Sep 17 00:00:00 2001 From: Glauber Costa Date: Thu, 2 May 2019 11:22:24 -0400 Subject: [PATCH] make scylla_util OS detection robust against empty lines Newer versions of RHEL ship the os-release file with newlines in the end, which our script was not prepared to handle. As such, scylla_setup would fail. This patch makes our OS detection robust against that. Fixes #4473 Branches: master, branch-3.1 Signed-off-by: Glauber Costa Message-Id: <20190502152224.31307-1-glauber@scylladb.com> (cherry picked from commit 99c00547adc2183fc6fe7f5f48d3a20a7e6f3d36) --- dist/common/scripts/scylla_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/common/scripts/scylla_util.py b/dist/common/scripts/scylla_util.py index aaa6014433..8bb64d359b 100644 --- a/dist/common/scripts/scylla_util.py +++ b/dist/common/scripts/scylla_util.py @@ -304,7 +304,7 @@ def parse_os_release_line(line): val = shlex.split(data)[0] return (id, val.split(' ') if id == 'ID' or id == 'ID_LIKE' else val) -os_release = dict([parse_os_release_line(x) for x in open('/etc/os-release').read().splitlines()]) +os_release = dict([parse_os_release_line(x) for x in open('/etc/os-release').read().splitlines() if re.match(r'\w+=', x) ]) def is_debian_variant(): d = os_release['ID_LIKE'] if 'ID_LIKE' in os_release else os_release['ID']