diskimage-builder/elements/cloud-init-datasources/install.d/05-set-cloud-init-sources
Nikhil Manchanda d550087214 Do not use DatasourceNone for precise cloud-init
The 'None' Datasource does not exist in precise 12.04 (which uses
cloud-init 0.6.3), so conditionally ensure that we are not including
this in the datasource_list in case we're building a precise image.

Partial-bug: 1329068
Change-Id: I6efb91e17bf896bbf7d67c31c4eb5098d5d61a71
2014-06-16 10:58:39 -07:00

25 lines
735 B
Bash
Executable File

#!/bin/bash
set -eu
set -o pipefail
DIB_CLOUD_INIT_DATASOURCES=${DIB_CLOUD_INIT_DATASOURCES:-""}
if [ -z "$DIB_CLOUD_INIT_DATASOURCES" ] ; then
echo "DIB_CLOUD_INIT_DATASOURCES must be set to a comma-separated list "
echo "of cloud-init data sources you wish to use, ie 'Ec2, NoCloud, ConfigDrive'"
exit 1
fi
# DatasourceNone doesn't exist in Ubuntu 12.04 (Precise)
# which uses cloud-init version 0.6.3
if [ "$(lsb_release -cs)" = 'precise' ] ; then
cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg <<EOF
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES ]
EOF
else
cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg <<EOF
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES, None ]
EOF
fi