Merge "Use str_replace for known_hosts" into stable/pike

This commit is contained in:
Zuul 2018-05-23 00:44:39 +00:00 committed by Gerrit Code Review
commit b4d2c3892e
2 changed files with 24 additions and 17 deletions

View File

@ -11,23 +11,29 @@ resources:
type: OS::Heat::SoftwareConfig
properties:
group: script
inputs:
- name: known_hosts
default: {get_param: known_hosts}
config: |
config:
str_replace:
params:
KNOWN_HOSTS: {get_param: known_hosts}
template: |
#!/bin/bash
set -eux
set -o pipefail
echo "Creating ssh known hosts file"
if [ ! -z "${known_hosts}" ]; then
echo "${known_hosts}"
echo -ne "${known_hosts}" > /etc/ssh/ssh_known_hosts
chmod 0644 /etc/ssh/ssh_known_hosts
else
if [ -d /etc/ssh/ssh_known_hosts ]; then
rm -rf /etc/ssh/ssh_known_hosts
fi
cat <<EOF | grep -v '^$' >/etc/ssh/ssh_known_hosts
KNOWN_HOSTS
EOF
if [ ! -s /etc/ssh/ssh_known_hosts ]; then
echo "No known hosts"
rm -f /etc/ssh/ssh_known_hosts
echo "No ssh known hosts"
else
echo "$(cat /etc/ssh/ssh_known_hosts | wc -l) known hosts"
chmod 0644 /etc/ssh/ssh_known_hosts
fi
outputs:

View File

@ -459,6 +459,7 @@ resources:
depends_on:
{% for role_inner in roles %}
- {{role_inner.name}}HostsDeployment
- {{role_inner.name}}SshKnownHostsDeployment
{% endfor %}
properties:
name: {{role.name}}AllNodesDeployment