From 6a8f64190d12af62a51f70bf0fab05e14da60bd3 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 4 May 2015 04:19:31 +0000 Subject: [PATCH] Do a better job of identifying CentOS 6 Since DIB creates a chroot but doesn't actually chroot in an extra-data script, look for /etc/redhat-release relative to the temporary chroot base path. Also given that the centos element leaves DIB_RELEASE exported as am empty string in the calling environment rather than unset, place it first in the conditional list. Change-Id: I0a51f88ff5ea71b6aa6e6406b656cefb0e135e88 --- .../extra-data.d/55-cache-devstack-repos | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos b/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos index 55cd97a61c..2bf675c36c 100755 --- a/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos +++ b/nodepool/elements/cache-devstack/extra-data.d/55-cache-devstack-repos @@ -20,20 +20,25 @@ import os import subprocess import sys +TMP_MOUNT_PATH = os.environ['TMP_MOUNT_PATH'] +TMP_HOOKS_PATH = os.environ['TMP_HOOKS_PATH'] + # this is a bit weird; we want to get the filter to use on the # devstack lib/[apt|rpm] files to pre-install them. So we have to # swizzle things around RELEASE=None +if 'DIB_RELEASE' in os.environ: + RELEASE=os.environ['DIB_RELEASE'] try: - if open('/etc/redhat-release').read().startswith('CentOS release 6'): + if open(os.path.join( + TMP_MOUNT_PATH, + 'etc/redhat-release')).read().startswith('CentOS release 6'): # not actually used in devstack, but for consistency and because this # script will error if run on a platform where RELEASE isn't detected # as something RELEASE='rhel6' except IOError: pass -if 'DIB_RELEASE' in os.environ: - RELEASE=os.environ['DIB_RELEASE'] if 'DISTRO_NAME' in os.environ: if os.environ['DISTRO_NAME'] == 'centos7': # centos7 matches as rhel7 in devstack @@ -42,9 +47,6 @@ if not RELEASE: print "Can not determine RELEASE" sys.exit(1) -TMP_MOUNT_PATH = os.environ['TMP_MOUNT_PATH'] -TMP_HOOKS_PATH = os.environ['TMP_HOOKS_PATH'] - DEVSTACK = os.path.join(TMP_MOUNT_PATH, 'opt/git/openstack-dev/devstack') CACHEDIR = os.path.join(TMP_MOUNT_PATH, 'tmp') IMAGES=os.path.join(TMP_HOOKS_PATH, 'source-repository-images')