mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-18 12:52:42 +03:00
Do not show missing user error if there is no ssh-key provided
fixes https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud/-/issues/41
This commit is contained in:
parent
fd24be8d96
commit
c4d2592e41
@ -217,6 +217,11 @@ init__set_hostname() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init__set_ssh_keys() {
|
init__set_ssh_keys() {
|
||||||
|
local sshkeys="$(imds @ssh-keys)"
|
||||||
|
if [ -z "$sshkeys" ]; then
|
||||||
|
log -i -t "$phase" info "$ACTION: no ssh key found"
|
||||||
|
return
|
||||||
|
fi
|
||||||
local user="$CLOUD_USER"
|
local user="$CLOUD_USER"
|
||||||
local pwent="$(getent passwd "$user")"
|
local pwent="$(getent passwd "$user")"
|
||||||
if [ -z "$pwent" ]; then
|
if [ -z "$pwent" ]; then
|
||||||
@ -235,7 +240,7 @@ init__set_ssh_keys() {
|
|||||||
touch "$keys_file"
|
touch "$keys_file"
|
||||||
chmod 600 "$keys_file"
|
chmod 600 "$keys_file"
|
||||||
$MOCK chown -R "$user:$group" "$ssh_dir"
|
$MOCK chown -R "$user:$group" "$ssh_dir"
|
||||||
imds @ssh-keys > "$keys_file"
|
echo "$sshkeys" > "$keys_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
init__save_userdata() {
|
init__save_userdata() {
|
||||||
|
|||||||
@ -54,6 +54,7 @@ no_userdata_main_body() {
|
|||||||
# we should not set empty hostname
|
# we should not set empty hostname
|
||||||
# we should not create .ssh dir for non-existing user
|
# we should not create .ssh dir for non-existing user
|
||||||
CLOUD="$provider" atf_check \
|
CLOUD="$provider" atf_check \
|
||||||
|
-e not-match:"failed" \
|
||||||
-e not-match:"unknown" \
|
-e not-match:"unknown" \
|
||||||
-o not-match:"hostname.*-F" \
|
-o not-match:"hostname.*-F" \
|
||||||
-o not-match:"chown.*/\.ssh" \
|
-o not-match:"chown.*/\.ssh" \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user