provision: Include DISTRIB_FAMILY in parse_lsb_release output.

This commit is contained in:
rht
2019-01-06 01:28:02 +00:00
committed by Tim Abbott
parent d9ef3fd505
commit 15763f8545
2 changed files with 6 additions and 3 deletions

View File

@@ -341,7 +341,8 @@ def parse_lsb_release():
codename = 'rhel' + info[6][0] # 7
distro_info = dict(
DISTRIB_CODENAME=codename,
DISTRIB_ID=vendor
DISTRIB_ID=vendor,
DISTRIB_FAMILY='redhat',
)
return distro_info
try:
@@ -356,6 +357,7 @@ def parse_lsb_release():
# from lsb_release in the exception code path.
continue
distro_info[k] = v
distro_info['DISTRIB_FAMILY'] = 'debian'
except FileNotFoundError:
# Unfortunately, Debian stretch doesn't yet have an
# /etc/lsb-release, so we instead fetch the pieces of data
@@ -364,7 +366,8 @@ def parse_lsb_release():
codename = subprocess_text_output(["lsb_release", "-cs"])
distro_info = dict(
DISTRIB_CODENAME=codename,
DISTRIB_ID=vendor
DISTRIB_ID=vendor,
DISTRIB_FAMILY='debian',
)
return distro_info

View File

@@ -120,7 +120,7 @@ if (not is_rhel_based) and (not os.path.exists("/usr/bin/lsb_release")):
distro_info = parse_lsb_release()
vendor = distro_info['DISTRIB_ID']
codename = distro_info['DISTRIB_CODENAME']
family = 'redhat' if vendor in ['CentOS', 'Fedora', 'RedHat'] else 'debian'
family = distro_info['DISTRIB_FAMILY']
if not (vendor in SUPPORTED_PLATFORMS and codename in SUPPORTED_PLATFORMS[vendor]):
logging.critical("Unsupported platform: {} {}".format(vendor, codename))
sys.exit(1)