From 1023e20f41107a2c62a8d2ef31f0f040abb400c1 Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Fri, 1 May 2015 18:53:12 +0000 Subject: [PATCH] Determine CentOS 6 platform in cache-devstack The centos element (which is CentOS 6.x specific) doesn't provide DIB_RELEASE so we have to identify it another way. Change-Id: Ibf3b25b99f03c6077538dec6c3770dc0f690e3f5 --- nodepool/elements/README.rst | 2 +- .../cache-devstack/extra-data.d/55-cache-devstack-repos | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/nodepool/elements/README.rst b/nodepool/elements/README.rst index 6b17659634..cdcb7adb2b 100644 --- a/nodepool/elements/README.rst +++ b/nodepool/elements/README.rst @@ -28,7 +28,7 @@ Building an image is simple, we have a script! :: - DISTRO="ubuntu" DIB_RELEASE="trusty" bash tools/build-image.sh + DISTRO="ubuntu" bash tools/build-image.sh See the script for environment variables to set distribution, etc. You should be left with a .qcow2 image file of your selected 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 f77c48e7f8..d40f693266 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 @@ -24,6 +24,14 @@ import sys # devstack lib/[apt|rpm] files to pre-install them. So we have to # swizzle things around RELEASE=None +try: + if open('/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: