Update DevStack plugin

Change-Id: Ife7c0a621e276ae0f23fa0828531098939dda588
This commit is contained in:
Federico Ressi 2019-11-27 10:50:57 +01:00
parent d4b125218a
commit 287b650b58
2 changed files with 51 additions and 53 deletions

View File

@ -11,65 +11,65 @@ function install_tobiko {
function configure_tobiko { function configure_tobiko {
# Write configuration to a new temporary file # Write configuration to a new temporary file
local tobiko_config=$(mktemp) local tobiko_conf_file=$(mktemp)
if [ -f "${TOBIKO_CONFIG}" ]; then if [ -f "${TOBIKO_CONF_FILE}" ]; then
# Start from existing tobiko.conf file # Start from existing tobiko.conf file
cp "${TOBIKO_CONFIG}" "${tobiko_config}" cp "${TOBIKO_CONF_FILE}" "${tobiko_conf}"
fi fi
configure_tobiko_default "${tobiko_config}" configure_tobiko_default "${tobiko_conf_file}"
configure_tobiko_cirros "${tobiko_config}" configure_tobiko_cirros "${tobiko_conf_file}"
configure_tobiko_glance "${tobiko_config}" configure_tobiko_glance "${tobiko_conf_file}"
configure_tobiko_keystone "${tobiko_config}" configure_tobiko_keystone "${tobiko_conf_file}"
configure_tobiko_nova "${tobiko_config}" configure_tobiko_nova "${tobiko_conf_file}"
configure_tobiko_neutron "${tobiko_config}" configure_tobiko_neutron "${tobiko_conf_file}"
echo_summary "Apply changes to actual ${TOBIKO_CONFIG} file." echo_summary "Apply changes to actual ${TOBIKO_CONF_FILE} file."
sudo mkdir -p $(dirname "${TOBIKO_CONFIG}") sudo mkdir -p $(dirname "${TOBIKO_CONF_FILE}")
sudo mv "${tobiko_config}" "${TOBIKO_CONFIG}" sudo mv "${tobiko_conf_file}" "${TOBIKO_CONF_FILE}"
sudo chmod ugo+r "${TOBIKO_CONFIG}" sudo chmod ugo+r "${TOBIKO_CONF_FILE}"
echo "${TOBIKO_CONFIG} file content:" echo "${TOBIKO_CONF_FILE} file content:"
echo -------------------------------- echo --------------------------------
cat "${TOBIKO_CONFIG}" cat "${TOBIKO_CONF_FILE}"
echo -------------------------------- echo --------------------------------
} }
function configure_tobiko_cirros { function configure_tobiko_cirros {
echo_summary "Write [cirros] section to ${TOBIKO_CONFIG}" echo_summary "Write [cirros] section to ${TOBIKO_CONF_FILE}"
local tobiko_config=$1 local tobiko_conf_file=$1
iniset_nonempty "${tobiko_config}" cirros name "${TOBIKO_CIRROS_IMAGE_NAME}" iniset_nonempty "${tobiko_conf_file}" cirros name "${TOBIKO_CIRROS_IMAGE_NAME}"
iniset_nonempty "${tobiko_config}" cirros url "${TOBIKO_CIRROS_IMAGE_URL}" iniset_nonempty "${tobiko_conf_file}" cirros url "${TOBIKO_CIRROS_IMAGE_URL}"
iniset_nonempty "${tobiko_config}" cirros file "${TOBIKO_CIRROS_IMAGE_FILE}" iniset_nonempty "${tobiko_conf_file}" cirros file "${TOBIKO_CIRROS_IMAGE_FILE}"
iniset_nonempty "${tobiko_config}" cirros username "${TOBIKO_CIRROS_USERNAME}" iniset_nonempty "${tobiko_conf_file}" cirros username "${TOBIKO_CIRROS_USERNAME}"
iniset_nonempty "${tobiko_config}" cirros password "${TOBIKO_CIRROS_PASSWORD}" iniset_nonempty "${tobiko_conf_file}" cirros password "${TOBIKO_CIRROS_PASSWORD}"
} }
function configure_tobiko_default { function configure_tobiko_default {
echo_summary "Write [DEFAULT] section to ${TOBIKO_CONFIG}" echo_summary "Write [DEFAULT] section to ${TOBIKO_CONF_FILE}"
local tobiko_config=$1 local tobiko_conf_file=$1
setup_logging "${tobiko_config}" setup_logging "${tobiko_conf_file}"
iniset ${tobiko_config} DEFAULT log_dir "${TOBIKO_LOG_DIR}" iniset ${tobiko_conf_file} DEFAULT debug "${TOBIKO_DEBUG}"
iniset ${tobiko_config} DEFAULT log_file "${TOBIKO_LOG_FILE}" iniset ${tobiko_conf_file} DEFAULT log_dir $(dirname "${TOBIKO_LOG_FILE}")
iniset ${tobiko_config} DEFAULT debug "${TOBIKO_DEBUG}" iniset ${tobiko_conf_file} DEFAULT log_file $(basename "${TOBIKO_LOG_FILE}")
} }
function configure_tobiko_glance { function configure_tobiko_glance {
echo_summary "Write [glance] section to ${TOBIKO_CONFIG}" echo_summary "Write [glance] section to ${TOBIKO_CONF_FILE}"
local tobiko_config=$1 local tobiko_conf_file=$1
iniset_nonempty "${tobiko_config}" glance image_dir "${TOBIKO_GLANCE_IMAGE_DIR}" iniset_nonempty "${tobiko_conf_file}" glance image_dir "${TOBIKO_GLANCE_IMAGE_DIR}"
} }
function configure_tobiko_keystone { function configure_tobiko_keystone {
echo_summary "Write [keystone] section to ${TOBIKO_CONFIG}" echo_summary "Write [keystone] section to ${TOBIKO_CONF_FILE}"
local tobiko_config=$1 local tobiko_conf_file=$1
local api_version=${IDENTITY_API_VERSION} local api_version=${IDENTITY_API_VERSION}
if [ "${api_version}" == '2' ]; then if [ "${api_version}" == '2' ]; then
@ -97,37 +97,37 @@ function configure_tobiko_keystone {
"${user_id}" \ "${user_id}" \
"${TOBIKO_KEYSTONE_USER_DOMAIN_NAME}") "${TOBIKO_KEYSTONE_USER_DOMAIN_NAME}")
iniset "${tobiko_config}" keystone cloud_name "${TOBIKO_KEYSTONE_CLOUD_NAME}" iniset "${tobiko_conf_file}" keystone cloud_name "${TOBIKO_KEYSTONE_CLOUD_NAME}"
iniset "${tobiko_config}" keystone api_version "${api_version}" iniset "${tobiko_conf_file}" keystone api_version "${api_version}"
iniset "${tobiko_config}" keystone auth_url "${auth_url}" iniset "${tobiko_conf_file}" keystone auth_url "${auth_url}"
iniset "${tobiko_config}" keystone username "${TOBIKO_KEYSTONE_USERNAME}" iniset "${tobiko_conf_file}" keystone username "${TOBIKO_KEYSTONE_USERNAME}"
iniset "${tobiko_config}" keystone password "${TOBIKO_KEYSTONE_PASSWORD}" iniset "${tobiko_conf_file}" keystone password "${TOBIKO_KEYSTONE_PASSWORD}"
iniset "${tobiko_config}" keystone project_name "${TOBIKO_KEYSTONE_PROJECT_NAME}" iniset "${tobiko_conf_file}" keystone project_name "${TOBIKO_KEYSTONE_PROJECT_NAME}"
if [ "${api_version}" != '2' ]; then if [ "${api_version}" != '2' ]; then
iniset "${tobiko_config}" keystone domain_name "${TOBIKO_KEYSTONE_DOMAIN_NAME}" iniset "${tobiko_conf_file}" keystone domain_name "${TOBIKO_KEYSTONE_DOMAIN_NAME}"
iniset "${tobiko_config}" keystone user_domain_name \ iniset "${tobiko_conf_file}" keystone user_domain_name \
"${TOBIKO_KEYSTONE_USER_DOMAIN_NAME}" "${TOBIKO_KEYSTONE_USER_DOMAIN_NAME}"
iniset "${tobiko_config}" keystone project_domain_name \ iniset "${tobiko_conf_file}" keystone project_domain_name \
"${TOBIKO_KEYSTONE_PROJECT_DOMAIN_NAME}" "${TOBIKO_KEYSTONE_PROJECT_DOMAIN_NAME}"
iniset "${tobiko_config}" keystone trust_id "${TOBIKO_KEYSTONE_TRUST_ID}" iniset "${tobiko_conf_file}" keystone trust_id "${TOBIKO_KEYSTONE_TRUST_ID}"
fi fi
} }
function configure_tobiko_nova { function configure_tobiko_nova {
echo_summary "Write [nova] section to ${TOBIKO_CONFIG}" echo_summary "Write [nova] section to ${TOBIKO_CONF_FILE}"
local tobiko_config=$1 local tobiko_conf_file=$1
# Write key_file # Write key_file
local key_file=${TOBIKO_NOVA_KEY_FILE:-} local key_file=${TOBIKO_NOVA_KEY_FILE:-}
iniset "${tobiko_config}" nova key_file "${key_file}" iniset "${tobiko_conf_file}" nova key_file "${key_file}"
} }
function configure_tobiko_neutron { function configure_tobiko_neutron {
echo_summary "Write [neutron] section to ${TOBIKO_CONFIG}" echo_summary "Write [neutron] section to ${TOBIKO_CONF_FILE}"
local tobiko_config=$1 local tobiko_conf_file=$1
# Write floating network # Write floating network
local floating_network=${TOBIKO_NEUTRON_FLOATING_NETWORK} local floating_network=${TOBIKO_NEUTRON_FLOATING_NETWORK}
@ -137,7 +137,7 @@ function configure_tobiko_neutron {
local networks=( $( openstack network list -f value -c Name --enable --external) ) local networks=( $( openstack network list -f value -c Name --enable --external) )
local floating_network=${networks[0]} local floating_network=${networks[0]}
fi fi
iniset "${tobiko_config}" neutron floating_network "${floating_network}" iniset "${tobiko_conf_file}" neutron floating_network "${floating_network}"
} }

View File

@ -7,11 +7,9 @@ GITBRANCH["tobiko"]=${TOBIKO_VERSION}
TOBIKO_DIR=${TOBIKO_DIR:-${DEST}/tobiko} TOBIKO_DIR=${TOBIKO_DIR:-${DEST}/tobiko}
GITDIR["tobiko"]=${TOBIKO_DIR} GITDIR["tobiko"]=${TOBIKO_DIR}
TOBIKO_CONFIG_DIR=${TOBIKO_CONFIG_DIR:-/etc/tobiko} TOBIKO_CONF_FILE=${TOBIKO_CONF_FILE:-/etc/tobiko/tobiko.conf}
TOBIKO_CONFIG=${TOBIKO_CONFIG:-${TOBIKO_CONFIG_DIR}/tobiko.conf}
TOBIKO_DEBUG=${TOBIKO_DEBUG:-True} TOBIKO_DEBUG=${TOBIKO_DEBUG:-True}
TOBIKO_LOG_DIR=${TOBIKO_LOG_DIR:-${LOGDIR:-}} TOBIKO_LOG_FILE=${TOBIKO_LOG_FILE:-${LOGDIR}/tobiko.log}
TOBIKO_LOG_FILE=${TOBIKO_LOG_FILE:-tobiko.log}
TOBIKO_BINDEP=${BINDEP_CMD:+-bindep} TOBIKO_BINDEP=${BINDEP_CMD:+-bindep}