Merge "Add new cloud-init-datasources element"

This commit is contained in:
Jenkins 2014-06-10 06:43:47 +00:00 committed by Gerrit Code Review
commit 343f70cd23
5 changed files with 39 additions and 9 deletions

View file

@ -0,0 +1,21 @@
Configures cloud-init to only use an explicit list of data sources.
Cloud-init contains a growing collection of data source modules and most
are enabled by default. This causes cloud-init to query each data source
on first boot. This can cause delays or even boot problems depending on your
environment.
You must define `DIB_CLOUD_INIT_DATASOURCES` as a comma-separated list of valid
data sources to limit the data sources that will be queried for metadata on
first boot.
For instance, to enable only the Ec2 datasource:
export `DIB_CLOUD_INIT_DATASOURCES`="Ec2"
Or to enable multiple:
export `DIB_CLOUD_INIT_DATASOURCES`="Ec2, ConfigDrive, OpenStack"
Including this element without setting `DIB_CLOUD_INIT_DATASOURCES` will cause
image builds to fail.

View file

@ -0,0 +1,16 @@
#!/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
cat > /etc/cloud/cloud.cfg.d/91-dib-cloud-init-datasources.cfg <<EOF
datasource_list: [ $DIB_CLOUD_INIT_DATASOURCES, None ]
EOF

View file

@ -0,0 +1 @@
cloud-init-datasources

View file

@ -0,0 +1 @@
export DIB_CLOUD_INIT_DATASOURCES="NoCloud"

View file

@ -1,9 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
cat > /etc/cloud/cloud.cfg.d/91-local-metadata-only.cfg <<EOF
# No cloud metadata available, use only what is in the image.
datasource_list: [ NoCloud, None ]
EOF