Pass options from local.conf ot tobiko.conf

Change-Id: I4fb90736e53e0ed90370cdc150a4fe4fbc7fc947
This commit is contained in:
Federico Ressi 2018-12-17 08:09:44 +01:00
parent 370b55db4e
commit de45aec61d
2 changed files with 40 additions and 23 deletions

View File

@ -2,32 +2,34 @@
TOBIKO_PLUGIN_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
function tobiko_install {
function install_tobiko {
echo_summary "Installing tobiko-plugin"
apt_get install python3-dev
setup_dev_lib "tobiko"
setup_dev_lib tobiko
}
function tobiko_test_config {
function configure_tobiko {
# Write configuration to a new temporary file
local tobiko_conf=$(mktemp)
if [ -f "${TOBIKO_CONF}" ]; then
# Start from existing tobiko.conf file
cp "${TOBIKO_CONF}" "${tobiko_conf}"
fi
# See ``lib/keystone`` where these users and tenants are set up
echo_summary "Write identity options to ${TOBIKO_CONF}"
echo_summary "Write identity service options to ${TOBIKO_CONF}"
iniset "${tobiko_conf}" identity auth_url "$(get_auth_url)"
iniset "${tobiko_conf}" identity username "${ADMIN_USERNAME:-admin}"
iniset "${tobiko_conf}" identity password "${ADMIN_PASSWORD:-secret}"
iniset "${tobiko_conf}" identity project "${ADMIN_TENANT_NAME:-admin}"
iniset "${tobiko_conf}" identity domain "${ADMIN_DOMAIN_NAME:-Default}"
echo_summary "Write compute options to ${TOBIKO_CONF}"
echo_summary "Write compute service options to ${TOBIKO_CONF}"
iniset "${tobiko_conf}" compute image_ref "$(get_image_ref)"
iniset "${tobiko_conf}" compute flavor_ref "$(get_flavor_ref)"
echo_summary "Write network options to ${TOBIKO_CONF}"
echo_summary "Write networking options to ${TOBIKO_CONF}"
iniset "${tobiko_conf}" network floating_network_name \
"$(get_floating_network_name)"
@ -42,35 +44,50 @@ function get_auth_url {
echo "${KEYSTONE_SERVICE_URI_V3:-${KEYSTONE_SERVICE_URI/v2.0/}}"
}
function get_image_ref {
local image_ids=( $(openstack image list -f value -c ID \
--property status=active) )
echo "${image_ids[0]}"
local name=${DEFAULT_IMAGE_NAME:-}
if [ "${name}" != "" ]; then
openstack image show -f value -c id "${name}"
else
openstack image list --limit 1 -f value -c ID --public --status active
fi
}
function get_flavor_ref {
local flavor_ids=( $(openstack flavor list -f value -c ID \
--public) )
echo "${flavor_ids[0]}"
local name=${DEFAULT_INSTANCE_TYPE:-}
if [ "${name}" != "" ]; then
openstack flavor show -f value -c id "${name}"
else
openstack flavor list --limit 1 -f value -c ID --public
fi
}
function get_floating_network_name {
local networks=( $(openstack network list -f value -c Name \
--enable --status ACTIVE \
--provider-network-type flat) )
echo "${networks[0]}"
# the public network (for floating ip access) is only available
# if the extension is enabled.
# If NEUTRON_CREATE_INITIAL_NETWORKS is not true, there is no network created
# and the public_network_id should not be set.
local name=${PUBLIC_NETWORK_NAME:-}
if [ "${name}" != "" ]; then
openstack network show -f value -c name "${name}"
else
local networks=( $( openstack network list -f value -c Name --enable \
--external) )
echo "${networks[0]}"
fi
}
if [[ "$1" == "stack" ]]; then
case "$2" in
install)
tobiko_install
install_tobiko
;;
test-config)
tobiko_test_config
configure_tobiko
;;
esac
fi

View File

@ -14,10 +14,7 @@ SERVICE_PASSWORD=secret
# User python 3
USE_PYTHON3=true
# Enable tobiko plugin
enable_plugin tobiko /vagrant
#Enable heat services
# Configure heat services ----------------------------------------------------
enable_plugin heat https://git.openstack.org/openstack/heat
# download and register a VM image that heat can launch
@ -26,7 +23,7 @@ IMAGE_URL_PATH="/pub/fedora/linux/releases/29/Cloud/x86_64/images/"
IMAGE_URL_FILE="Fedora-Cloud-Base-29-1.2.x86_64.qcow2"
IMAGE_URLS+=","$IMAGE_URL_SITE$IMAGE_URL_PATH$IMAGE_URL_FILE
# Configure neutron
# Configure neutron ----------------------------------------------------------
enable_service neutron
NETWORK_API_EXTENSIONS=address-scope,agent,allowed-address-pairs,auto-allocated-topology,availability_zone,binding,default-subnetpools,dhcp_agent_scheduler,dns-domain-ports,dns-integration,dvr,empty-string-filtering,ext-gw-mode,external-net,extra_dhcp_opt,extraroute,filter-validation,fip-port-details,flavors,ip-substring-filtering,l3-flavors,l3-ha,l3_agent_scheduler,logging,metering,multi-provider,net-mtu,net-mtu-writable,network-ip-availability,network_availability_zone,pagination,port-security,project-id,provider,qos,qos-bw-minimum-ingress,qos-fip,quotas,quota_details,rbac-policies,router,router_availability_zone,security-group,port-mac-address-regenerate,port-security-groups-filtering,segment,service-type,sorting,standard-attr-description,standard-attr-revisions,standard-attr-segment,standard-attr-timestamp,standard-attr-tag,subnet_allocation,trunk,trunk-details,uplink-status-propagation
@ -52,3 +49,6 @@ IP_VERSION=4
# IPV6_ADDRESS_MODE=slaac
# IPV6_ADDRS_SAFE_TO_USE=fd$IPV6_GLOBAL_ID::/56
# IPV6_PRIVATE_NETWORK_GATEWAY=fd$IPV6_GLOBAL_ID::1
# Enable tobiko plugin ------------------------------------------------------
enable_plugin tobiko /vagrant