Fix ZUUL_USER_SSH_PUBLIC_KEY to support ssh key content
Currently ZUUL_USER_SSH_PUBLIC_KEY must be a key file, but there is no change to create the key file, so it not convenient for building a image with diskimage-builder, this patch makes it possible to set ssh public key through ZUUL_USER_SSH_PUBLIC_KEY in envirement(e.g. diskimage configuration in nodepool.yaml ). Change-Id: I83ef3d2e5ff5c3951ecf7036c46d0d8a68871e0c Signed-off-by: shangxdy <shang.xiaodong@zte.com.cn>
This commit is contained in:
parent
a7ef241166
commit
fa1e7d4097
@ -8,9 +8,12 @@ set -o pipefail
|
||||
|
||||
ZUUL_USER_SSH_PUBLIC_KEY=${ZUUL_USER_SSH_PUBLIC_KEY:-$HOME/.ssh/id_rsa.pub}
|
||||
|
||||
if [ ! -f $ZUUL_USER_SSH_PUBLIC_KEY ]; then
|
||||
if [ -f "$ZUUL_USER_SSH_PUBLIC_KEY" ]; then
|
||||
# save the public key inside the chroot from specific file
|
||||
cat $ZUUL_USER_SSH_PUBLIC_KEY >> $TMP_HOOKS_PATH/zuul-user-ssh-public-key
|
||||
elif [ -n "$ZUUL_USER_SSH_PUBLIC_KEY" ]; then
|
||||
# save the specific public key inside the chroot from env derectly
|
||||
echo "$ZUUL_USER_SSH_PUBLIC_KEY" >> $TMP_HOOKS_PATH/zuul-user-ssh-public-key
|
||||
else
|
||||
die "Can not find public key for zuul user!"
|
||||
fi
|
||||
|
||||
# save the public key inside the chroot
|
||||
cat $ZUUL_USER_SSH_PUBLIC_KEY >> $TMP_HOOKS_PATH/zuul-user-ssh-public-key
|
||||
|
Loading…
Reference in New Issue
Block a user