f58bf252de
Ubuntu 12.04 LTS reached its regular End of Life on April 28, 2017. Depends-On: I5e145095a10db112bb27516bfe652d2cdc052a61 Change-Id: I64af4c5183d77a75dcd062895d19b0a1330c8da8
34 lines
1,018 B
Bash
Executable file
34 lines
1,018 B
Bash
Executable file
#!/bin/bash
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
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
|
|
|
|
if [ -d /etc/cloud/cloud.cfg.d ]; then
|
|
cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg <<EOF
|
|
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES, None ]
|
|
EOF
|
|
# Newer cloud-init versions complain by default when they should
|
|
# use the Ec2 datasource on a non-AWS cloud. If the Ec2
|
|
# datasource is desired, we need to tell cloud-init that we really
|
|
# want this. Otherwise there will be ugly warnings or worse.
|
|
#
|
|
if [[ $DIB_CLOUD_INIT_DATASOURCES =~ Ec2 ]]; then
|
|
cat > /etc/cloud/cloud.cfg.d/92-ec2-datasource.cfg <<EOF
|
|
#cloud-config
|
|
datasource:
|
|
Ec2:
|
|
strict_id: false
|
|
EOF
|
|
fi
|
|
fi
|