Ensure local SSH key can login localhost
Change-Id: I03f7b9ec68c55f4819698775524ce4df6875d511
This commit is contained in:
parent
0d46934bb6
commit
a2a8b4467d
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@ -39,7 +39,7 @@ TOX_ENVLIST = ENV.fetch('TOX_ENVLIST', '')
|
|||||||
TOX_EXTRA_ARGS = ENV.fetch('TOX_EXTRA_ARGS', '--notest')
|
TOX_EXTRA_ARGS = ENV.fetch('TOX_EXTRA_ARGS', '--notest')
|
||||||
|
|
||||||
# Allow to switch configuration
|
# Allow to switch configuration
|
||||||
DEVSTACK_CONF_NAME = ENV.fetch('DEVSTACK_CONF_NAME', 'ovn')
|
DEVSTACK_CONF_NAME = ENV.fetch('DEVSTACK_CONF_NAME', 'ovs')
|
||||||
|
|
||||||
DEVSTACK_LOCAL_CONF_FILE = ENV.fetch(
|
DEVSTACK_LOCAL_CONF_FILE = ENV.fetch(
|
||||||
'DEVSTACK_LOCAL_CONF_FILE',
|
'DEVSTACK_LOCAL_CONF_FILE',
|
||||||
|
@ -19,8 +19,8 @@ repository. See contrib/vagrant to create a vagrant VM.
|
|||||||
|
|
||||||
3. Tobiko require Heat to be enabled, so heat should be also enabled::
|
3. Tobiko require Heat to be enabled, so heat should be also enabled::
|
||||||
|
|
||||||
[[local|localrc]]
|
> cat local.conf
|
||||||
enable_plugin heat https://opendev.org/openstack/heat
|
[[local|localrc]]
|
||||||
|
enable_plugin heat https://opendev.org/openstack/heat
|
||||||
|
|
||||||
3. Run ``stack.sh``
|
3. Run ``stack.sh``
|
||||||
|
@ -36,6 +36,7 @@ function configure_tobiko {
|
|||||||
configure_tobiko_keystone "${tobiko_conf_file}"
|
configure_tobiko_keystone "${tobiko_conf_file}"
|
||||||
configure_tobiko_nova "${tobiko_conf_file}"
|
configure_tobiko_nova "${tobiko_conf_file}"
|
||||||
configure_tobiko_neutron "${tobiko_conf_file}"
|
configure_tobiko_neutron "${tobiko_conf_file}"
|
||||||
|
configure_tobiko_ssh "${tobiko_conf_file}"
|
||||||
|
|
||||||
echo_summary "Apply changes to actual ${TOBIKO_CONF_FILE} file."
|
echo_summary "Apply changes to actual ${TOBIKO_CONF_FILE} file."
|
||||||
sudo mkdir -p $(dirname "${TOBIKO_CONF_FILE}")
|
sudo mkdir -p $(dirname "${TOBIKO_CONF_FILE}")
|
||||||
@ -151,17 +152,8 @@ function configure_tobiko_nova {
|
|||||||
|
|
||||||
(
|
(
|
||||||
cd $(dirname "${tobiko_conf_file}")
|
cd $(dirname "${tobiko_conf_file}")
|
||||||
local key_file=${TOBIKO_NOVA_KEY_FILE}
|
configure_key_file "${tobiko_conf_file}" nova key_file \
|
||||||
if [ "${key_file}" != "" ]; then
|
"${TOBIKO_NOVA_KEY_FILE}"
|
||||||
iniset "${tobiko_conf_file}" nova key_file "${key_file}"
|
|
||||||
else
|
|
||||||
# Use the default keyfile name
|
|
||||||
key_file=~/.ssh/id_rsa
|
|
||||||
fi
|
|
||||||
if ! [ -r "${key_file}" ]; then
|
|
||||||
mkdir -p $(dirname "${key_file}")
|
|
||||||
ssh-keygen -f "${key_file}" -N ""
|
|
||||||
fi
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,6 +171,43 @@ function configure_tobiko_neutron {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function configure_tobiko_ssh {
|
||||||
|
echo_summary "Write [ssh] section to ${TOBIKO_CONF_FILE}"
|
||||||
|
local tobiko_conf_file=$1
|
||||||
|
|
||||||
|
(
|
||||||
|
cd $(dirname "${tobiko_conf_file}")
|
||||||
|
configure_key_file "${tobiko_conf_file}" ssh key_file \
|
||||||
|
"${TOBIKO_SSH_KEY_FILE}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function configure_key_file {
|
||||||
|
local tobiko_conf_file=$1
|
||||||
|
|
||||||
|
ensure_key_file "${key_file}"
|
||||||
|
iniset_nonempty "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function ensure_key_file {
|
||||||
|
local key_file=${1:-~/.ssh/id_rsa}
|
||||||
|
# Ensure key file exists
|
||||||
|
if ! [ -r "${key_file}" ]; then
|
||||||
|
mkdir -p $(dirname "${key_file}")
|
||||||
|
ssh-keygen -f "${key_file}" -N ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Ensure Tobiko can SSH localhost using key file
|
||||||
|
local pub_key
|
||||||
|
pub_key=$(cat "${key_file}.pub")
|
||||||
|
if ! grep "${pub_key}" ~/.ssh/authorized_keys; then
|
||||||
|
cat "${key_file}.pub" >> ~/.ssh/authorized_keys
|
||||||
|
fi
|
||||||
|
chmod 600 "${key_file}" "${key_file}.pub" ~/.ssh/authorized_keys
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function iniset_nonempty {
|
function iniset_nonempty {
|
||||||
# Calls iniset only when option value is not an empty string
|
# Calls iniset only when option value is not an empty string
|
||||||
if [ -n "$4" ]; then
|
if [ -n "$4" ]; then
|
||||||
|
@ -41,3 +41,6 @@ TOBIKO_NOVA_KEY_FILE=${TOBIKO_NOVA_KEY_FILE:-}
|
|||||||
TOBIKO_NEUTRON_FLOATING_NETWORK=${TOBIKO_NEUTRON_FLOATING_NETWORK:-${PUBLIC_NETWORK_NAME}}
|
TOBIKO_NEUTRON_FLOATING_NETWORK=${TOBIKO_NEUTRON_FLOATING_NETWORK:-${PUBLIC_NETWORK_NAME}}
|
||||||
TOBIKO_NEUTRON_IPV4_DNS_NAMESERVERS=${TOBIKO_NEUTRON_IPV4_DNS_NAMESERVERS:-}
|
TOBIKO_NEUTRON_IPV4_DNS_NAMESERVERS=${TOBIKO_NEUTRON_IPV4_DNS_NAMESERVERS:-}
|
||||||
TOBIKO_NEUTRON_IPV6_DNS_NAMESERVERS=${TOBIKO_NEUTRON_IPV6_DNS_NAMESERVERS:-}
|
TOBIKO_NEUTRON_IPV6_DNS_NAMESERVERS=${TOBIKO_NEUTRON_IPV6_DNS_NAMESERVERS:-}
|
||||||
|
|
||||||
|
# --- SSH settings ---
|
||||||
|
TOBIKO_SSH_KEY_FILE=${TOBIKO_SSH_KEY_FILE:-}
|
||||||
|
@ -7,7 +7,6 @@ SERVICE_PASSWORD=$ADMIN_PASSWORD
|
|||||||
LOGFILE=/opt/stack/devstack/stack.log
|
LOGFILE=/opt/stack/devstack/stack.log
|
||||||
LOG_COLOR=False
|
LOG_COLOR=False
|
||||||
|
|
||||||
|
|
||||||
# Disable unrequired services -------------------------------------------------
|
# Disable unrequired services -------------------------------------------------
|
||||||
|
|
||||||
disable_service horizon
|
disable_service horizon
|
||||||
@ -30,3 +29,5 @@ enable_plugin heat https://opendev.org/openstack/heat.git
|
|||||||
# Configure Tobiko ------------------------------------------------------------
|
# Configure Tobiko ------------------------------------------------------------
|
||||||
|
|
||||||
enable_plugin devstack-plugin-tobiko https://opendev.org/x/devstack-plugin-tobiko.git
|
enable_plugin devstack-plugin-tobiko https://opendev.org/x/devstack-plugin-tobiko.git
|
||||||
|
|
||||||
|
TOBIKO_NEUTRON_IPV4_DNS_NAMESERVERS=1.1.1.1,8.8.8.8
|
||||||
|
Loading…
x
Reference in New Issue
Block a user