Clean final newline when distributing SSH keys
When a pattern containing newlines is given to grep, it treats each line as a different pattern, and ORs these patterns together. The empty string always matches, therefore grep always returns a successful match. Change-Id: I881c90979995e060d24988438a710376e54331b8 Closes-Bug: #1615624
This commit is contained in:
parent
e13a00ce54
commit
354147b7c7
@ -19,7 +19,7 @@ fi
|
||||
|
||||
{% for item in groups['nova_compute'] %}
|
||||
{% if hostvars[item]['nova_pubkey'] is defined %}
|
||||
KEY="{{ hostvars[item]['nova_pubkey'] | b64decode }}"
|
||||
KEY="{{ hostvars[item]['nova_pubkey'] | b64decode | trim }}"
|
||||
if ! grep -q -w "${KEY}" "${USER_HOME}/.ssh/authorized_keys"; then
|
||||
echo "${KEY}" | tee -a "${USER_HOME}/.ssh/authorized_keys"
|
||||
EXIT_CODE=3
|
||||
|
Loading…
x
Reference in New Issue
Block a user