Add an element to install os-net-config.

Change-Id: Ide8c5645c272a80521a57e4696ae4e0cbfed6750
This commit is contained in:
Dan Prince 2014-07-01 22:12:58 -04:00
parent 4b3d93e144
commit 6d3515cd9d
7 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,31 @@
Install, configure, and (optionally) run os-net-config.
Installs os-net-config and configures a JSON formatted config file
at /etc/os-net-config/config.json. The os-net-config command
is only executed if configuration metadata is provided.
Configuration
-------------
os\_net\_config: JSON (or YAML) metadata in the os-net-config format.
Config Examples:
---------------
```
{ "os_net_config":
{ "network_config": [
{
"type": "ovs_bridge",
"name": "br-ctlplane",
"use_dhcp": "true",
"primary": "true",
"members": [
{
"type": "interface",
"name": "em1"
}
]
}
]}
}
```

View File

@ -0,0 +1,3 @@
os-apply-config
os-refresh-config
pip-manifest

View File

@ -0,0 +1,6 @@
if [ -z "${OS_NET_CONFIG_VENV_DIR:-}" ]; then
export OS_NET_CONFIG_VENV_DIR=${OPENSTACK_VENV_DIR:-"/opt/stack/venvs/os-net-config"}
fi
if [ -z "${OS_NET_CONFIG_INSTALL_OPTS:-}" ]; then
export OS_NET_CONFIG_INSTALL_OPTS=${OPENSTACK_EXTRA_INSTALL_OPTS:-""}
fi

View File

@ -0,0 +1,4 @@
#!/bin/bash
set -eux
install-packages os-net-config

View File

@ -0,0 +1,31 @@
#!/bin/bash
set -ex
manifest=$(get-pip-manifest os-net-config)
virtualenv --setuptools $OS_NET_CONFIG_VENV_DIR
set +u
source $OS_NET_CONFIG_VENV_DIR/bin/activate
set -u
if [ -n "$manifest" ]; then
use-pip-manifest $manifest
else
# bug #1201253 : virtualenv-1.10.1 embeds setuptools-0.9.8, which
# doesn't manage correctly HTTPS sockets when downloading pbr from
# https://pypi.python.org/simple/ if using http_proxy and https_proxy
# envvars
$OS_NET_CONFIG_VENV_DIR/bin/pip install -U 'setuptools>=1.0'
# bug #1293812 : Avoid easy_install triggering on pbr.
$OS_NET_CONFIG_VENV_DIR/bin/pip install -U 'pbr>=0.6,<1.0'
$OS_NET_CONFIG_VENV_DIR/bin/pip install --pre -U os-net-config
fi
# Write the manifest of what was installed
write-pip-manifest os-net-config
ln -s $OS_NET_CONFIG_VENV_DIR/bin/os-net-config /usr/local/bin/os-net-config
set +u
deactivate
set -u

View File

@ -0,0 +1,3 @@
{{#os_net_config}}
{{.}}
{{/os_net_config}}

View File

@ -0,0 +1,8 @@
#!/bin/bash
set -eux
NET_CONFIG=$(os-apply-config --key os_net_config --type raw --key-default '')
if [ -n "$NET_CONFIG" ]; then
os-net-config -c /etc/os-net-config/config.json -d
fi