Restore elements still in use

This partially reverts commit c653eaee1c
that was a bit too aggressived and removed elements still in use by the
gate-tripleo-buildimage-overcloud-full-centos-7 CI job.

[1] http://logs.openstack.org/73/455373/1/check/gate-tripleo-buildimage-overcloud-full-centos-7/a7f385b/console.html#_2017-04-13_06_18_00_002828

Change-Id: I98b31f039b144357b00c0c8f64bead033804ce8f
This commit is contained in:
Martin André 2017-04-13 11:13:57 +02:00
parent c653eaee1c
commit f283d70a10
11 changed files with 125 additions and 0 deletions

View File

@ -0,0 +1,18 @@
Configure the image to pull packages from a Delorean repo
This element configures the image such that it downloads
packages from the specified Delorean repository. To use set
DELOREAN\_REPO\_URL to the Delorean repo you'd like to use.
This can be 'current' or any revision in the past that you'd
like to use. Example:
export DELOREAN\_REPO\_URL=http://localhost/~user/repos/current
Delorean is a tool that can be used to automate building upstream
packages:
https://github.com/openstack-packages/delorean
The Delorean tool currently supports Fedora packages and Yum
repositories. Support for other distributions may be added in
the future.

View File

@ -0,0 +1 @@
pkg-map

View File

@ -0,0 +1,5 @@
{
"default": {
"yum_plugin_priorities_package": "yum-plugin-priorities"
}
}

View File

@ -0,0 +1,5 @@
#!/bin/bash
set -e
set -o xtrace
yum clean metadata

View File

@ -0,0 +1,25 @@
#!/bin/bash
set -e
set -o xtrace
export DELOREAN_REPO_FILE=${DELOREAN_REPO_FILE:-"delorean.repo"}
# delorean requires delorean-deps
if [[ "rhel7 centos7" =~ "$DISTRO_NAME" ]]; then
if [ -z "$STABLE_RELEASE" ]; then
curl -L http://trunk.rdoproject.org/centos7/delorean-deps.repo -o /etc/yum.repos.d/delorean-deps.repo
else
curl -L http://trunk.rdoproject.org/centos7-$STABLE_RELEASE/delorean-deps.repo -o /etc/yum.repos.d/delorean-deps.repo
fi
elif [[ "fedora" =~ "$DISTRO_NAME" ]]; then
curl -L http://trunk.rdoproject.org/f$DIB_RELEASE/delorean-deps.repo -o /etc/yum.repos.d/delorean-deps.repo
fi
if [ -n "$DELOREAN_REPO_URL" ]; then
curl -L $DELOREAN_REPO_URL/$DELOREAN_REPO_FILE -o /etc/yum.repos.d/$DELOREAN_REPO_FILE
else
echo "Please configure a DELOREAN_REPO_URL."
exit 1
fi

View File

@ -0,0 +1,5 @@
#!/bin/bash
set -e
set -o xtrace
install-packages -m delorean-repo yum_plugin_priorities_package

5
elements/hosts/README.md Normal file
View File

@ -0,0 +1,5 @@
Permit injecting content into /etc/hosts from heat
# Configuration
hosts: '192.0.2.1 my-host.example.com'

View File

@ -0,0 +1,2 @@
os-apply-config
os-refresh-config

View File

@ -0,0 +1,51 @@
#!/bin/bash
set -eux
set -o pipefail
write_entries() {
local file="$1"
local entries="$2"
# Don't do anything if the file isn't there
if [ ! -f "$file" ]; then
return
fi
if grep -q "^# HEAT_HOSTS_START" "$file"; then
temp=$(mktemp)
(
sed '/^# HEAT_HOSTS_START/,$d' "$file"
echo -ne "\n# HEAT_HOSTS_START - Do not edit manually within this section!\n"
echo "$entries"
echo -ne "# HEAT_HOSTS_END\n\n"
sed '1,/^# HEAT_HOSTS_END/d' "$file"
) > "$temp"
echo "INFO: Updating hosts file $file, check below for changes"
diff "$file" "$temp" || true
cat "$temp" > "$file"
else
echo -ne "\n# HEAT_HOSTS_START - Do not edit manually within this section!\n" >> "$file"
echo "$entries" >> "$file"
echo -ne "# HEAT_HOSTS_END\n\n" >> "$file"
fi
}
ENTRIES=$(os-apply-config --key hosts --type raw --key-default '' | tr '[A-Z]' '[a-z]' | sed -e 's/\\n/\n/g' -e '/^$/d')
if [ ! -z "$ENTRIES" ]; then
# cloud-init files are /etc/cloud/templates/hosts.OSNAME.tmpl
DIST=$(lsb_release -is | tr -s '[A-Z]' '[a-z]')
case $DIST in
fedora|redhatenterpriseserver)
name="redhat"
;;
*)
name="$DIST"
;;
esac
write_entries "/etc/cloud/templates/hosts.${name}.tmpl" "$ENTRIES"
write_entries "/etc/hosts" "$ENTRIES"
else
echo "No hosts in Heat, nothing written."
fi

View File

@ -0,0 +1 @@
lsb_release:

7
elements/hosts/pkg-map Normal file
View File

@ -0,0 +1,7 @@
{
"family": {
"redhat": {
"lsb_release": "redhat-lsb-core"
}
}
}