mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-16 11:52:43 +03:00
install user-data handlers, tweak logging
This commit is contained in:
parent
13b0eef9fe
commit
bc6edeeaa5
6
Makefile
6
Makefile
@ -14,6 +14,10 @@ core:
|
|||||||
lib/tiny-cloud/init \
|
lib/tiny-cloud/init \
|
||||||
lib/tiny-cloud/mdev \
|
lib/tiny-cloud/mdev \
|
||||||
lib/tiny-cloud/tiny-cloud.conf
|
lib/tiny-cloud/tiny-cloud.conf
|
||||||
|
install -Dm644 -t "$(PREFIX)"/lib/tiny-cloud/user-data" \
|
||||||
|
lib/tiny-cloud/user-data/missing \
|
||||||
|
lib/tiny-cloud/user-data/script \
|
||||||
|
lib/tiny-cloud/user-data/unknown
|
||||||
install -Dm644 lib/tiny-cloud/tiny-cloud.conf \
|
install -Dm644 lib/tiny-cloud/tiny-cloud.conf \
|
||||||
"$(PREFIX)"/etc/tiny-cloud.conf
|
"$(PREFIX)"/etc/tiny-cloud.conf
|
||||||
install -Dm755 -t "$(PREFIX)"/sbin \
|
install -Dm755 -t "$(PREFIX)"/sbin \
|
||||||
@ -60,6 +64,8 @@ alpine:
|
|||||||
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/alpine \
|
install -Dm644 -t $(PREFIX)/lib/tiny-cloud/cloud/alpine \
|
||||||
lib/tiny-cloud/cloud/alpine/init
|
lib/tiny-cloud/cloud/alpine/init
|
||||||
ln -s ../nocloud/imds $(PREFIX)/lib/tiny-cloud/cloud/alpine/imds
|
ln -s ../nocloud/imds $(PREFIX)/lib/tiny-cloud/cloud/alpine/imds
|
||||||
|
install -Dm644 -t "$(PREFIX)"/lib/tiny-cloud/user-data" \
|
||||||
|
lib/tiny-cloud/user-data/alpine-config
|
||||||
|
|
||||||
check: tests/Kyuafile Kyuafile
|
check: tests/Kyuafile Kyuafile
|
||||||
kyua test || (kyua report --verbose && exit 1)
|
kyua test || (kyua report --verbose && exit 1)
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# vim:set ts=2 et:
|
# vim:set ts=2 et:
|
||||||
|
|
||||||
|
# NOTE: The mdev-conf APK handles this now, but only for xvd or sd links (not
|
||||||
|
# both)
|
||||||
|
|
||||||
: "${LIBDIR:=$PREFIX/lib}"
|
: "${LIBDIR:=$PREFIX/lib}"
|
||||||
. "$LIBDIR/tiny-cloud/common"
|
. "$LIBDIR/tiny-cloud/common"
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,11 @@
|
|||||||
|
|
||||||
log() {
|
log() {
|
||||||
local facility="local7"
|
local facility="local7"
|
||||||
local stderr
|
local stderr init
|
||||||
local tag=$(basename "$0")
|
local tag=$(basename "$0")
|
||||||
while [ "${1#-}" != "$1" ]; do
|
while [ "${1#-}" != "$1" ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
-i) init=1 ;; # TODO: value = indent?
|
||||||
-f) facility="$2"; shift ;;
|
-f) facility="$2"; shift ;;
|
||||||
-s) stderr=-s ;;
|
-s) stderr=-s ;;
|
||||||
-t) tag="$tag/$2"; shift ;;
|
-t) tag="$tag/$2"; shift ;;
|
||||||
@ -24,6 +25,7 @@ log() {
|
|||||||
[ -z "$DEBUG" ] && [ "$level" = debug ] && return
|
[ -z "$DEBUG" ] && [ "$level" = debug ] && return
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
[ -n "$init" ] && echo "$@" >&2
|
||||||
logger $stderr -p "$facility.$level" -t "$tag[$$]" "$@"
|
logger $stderr -p "$facility.$level" -t "$tag[$$]" "$@"
|
||||||
case "$level" in
|
case "$level" in
|
||||||
crit|alert|emerg) exit 1 ;;
|
crit|alert|emerg) exit 1 ;;
|
||||||
|
|||||||
@ -68,23 +68,22 @@ init__install_hotplugs() {
|
|||||||
. "$LIBDIR/tiny-cloud/$HOTPLUG_TYPE"
|
. "$LIBDIR/tiny-cloud/$HOTPLUG_TYPE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf ': ' >&2
|
|
||||||
for module in $HOTPLUG_MODULES; do
|
for module in $HOTPLUG_MODULES; do
|
||||||
result='?'
|
result='unknown'
|
||||||
level='err'
|
level='err'
|
||||||
printf "$module" >&2
|
printf " >> " >&2
|
||||||
log info "$phase $ACTION $module"
|
log -i -t "$phase/$ACTION" info "$module: installing"
|
||||||
if type "mod__$module" | grep -q -w "function"; then
|
if type "mod__$module" | grep -q -w "function"; then
|
||||||
if "mod__$module"; then
|
if "mod__$module"; then
|
||||||
result='+'
|
result='installed'
|
||||||
level='info'
|
level='info'
|
||||||
else
|
else
|
||||||
result='!'
|
result='failed'
|
||||||
rc=1
|
rc=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
printf '(%s) ' $result >&2
|
printf " >> " >&2
|
||||||
log "$level" "$phase $ACTION $module ($result)"
|
log -i -t "$phase/$ACTION" info "$module: $result"
|
||||||
done
|
done
|
||||||
return $rc
|
return $rc
|
||||||
}
|
}
|
||||||
@ -145,8 +144,7 @@ auto_detect_ethernet_interface() {
|
|||||||
|
|
||||||
init__set_default_interfaces() {
|
init__set_default_interfaces() {
|
||||||
if [ -f "$ROOT"/etc/network/interfaces ]; then
|
if [ -f "$ROOT"/etc/network/interfaces ]; then
|
||||||
echo "already set up" >&2
|
log -i -t "$phase" info "$ACTION: already set up"
|
||||||
log info "$phase $ACTION - already set up"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -171,8 +169,7 @@ init__create_default_user() {
|
|||||||
local user="$CLOUD_USER"
|
local user="$CLOUD_USER"
|
||||||
# don't do anything if it already exists
|
# don't do anything if it already exists
|
||||||
if getent passwd "$user" >/dev/null; then
|
if getent passwd "$user" >/dev/null; then
|
||||||
echo "already exists" >&2
|
log -i -t "$phase" info "$ACTION: already exists"
|
||||||
log info "$phase $ACTION - already exists"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -202,15 +199,13 @@ init__enable_sshd() {
|
|||||||
init__set_hostname() {
|
init__set_hostname() {
|
||||||
local fqdn=$(imds @hostname)
|
local fqdn=$(imds @hostname)
|
||||||
if [ -z "$fqdn" ]; then
|
if [ -z "$fqdn" ]; then
|
||||||
echo "no hostname set" >&2
|
log -i -t "$phase" info "$ACTION: no hostname set"
|
||||||
log info "No hostname set"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local host="${fqdn%%\.*}"
|
local host="${fqdn%%\.*}"
|
||||||
if [ -z "$host" ]; then
|
if [ -z "$host" ]; then
|
||||||
echo "$hostname is not a valid FQDN" >&2
|
log -i -t "$phase" warn "$ACTION: invalid hostname '$fqdn'"
|
||||||
log err "$fqdn is not a valid FQDN"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -224,8 +219,7 @@ init__set_ssh_keys() {
|
|||||||
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
|
||||||
echo "failed to find $user" >&2
|
log -i -t "$phase" err "$ACTION: failed to find user $user"
|
||||||
log err "Failed to find user $user"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
local group=$(echo "$pwent" | cut -d: -f4)
|
local group=$(echo "$pwent" | cut -d: -f4)
|
||||||
@ -246,7 +240,7 @@ init__set_ssh_keys() {
|
|||||||
init__save_userdata() {
|
init__save_userdata() {
|
||||||
local userdata="$TINY_CLOUD_VAR/user-data"
|
local userdata="$TINY_CLOUD_VAR/user-data"
|
||||||
if [ -f "$userdata" ]; then
|
if [ -f "$userdata" ]; then
|
||||||
log info "user-data already saved"
|
log -i -t "$phase" info "$ACTION: user-data already saved"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
local tmpfile=$(mktemp "$userdata.XXXXXX")
|
local tmpfile=$(mktemp "$userdata.XXXXXX")
|
||||||
@ -285,7 +279,6 @@ fi
|
|||||||
|
|
||||||
### load user-data type-specific init functions / vars (potentially overriding)
|
### load user-data type-specific init functions / vars (potentially overriding)
|
||||||
|
|
||||||
# this should be non-overrideable, but need this before we...
|
|
||||||
userdata_type() {
|
userdata_type() {
|
||||||
if [ ! -f "$TINY_CLOUD_VAR/user-data" ]; then
|
if [ ! -f "$TINY_CLOUD_VAR/user-data" ]; then
|
||||||
echo missing
|
echo missing
|
||||||
@ -303,4 +296,3 @@ USERDATA_TYPE="$(userdata_type)"
|
|||||||
if [ -f "$LIBDIR/tiny-cloud/user-data/$USERDATA_TYPE" ]; then
|
if [ -f "$LIBDIR/tiny-cloud/user-data/$USERDATA_TYPE" ]; then
|
||||||
. "$LIBDIR/tiny-cloud/user-data/$USERDATA_TYPE"
|
. "$LIBDIR/tiny-cloud/user-data/$USERDATA_TYPE"
|
||||||
fi
|
fi
|
||||||
# TODO: some indication that the user-data type is unsupported?
|
|
||||||
|
|||||||
@ -1,4 +1,8 @@
|
|||||||
# Missing UserData Functions
|
# Missing UserData Functions
|
||||||
# vim:set ts=4 et ft=sh:
|
# vim:set ts=4 et ft=sh:
|
||||||
|
|
||||||
# TODO: what to do if we have NO user-data yet
|
init__missing_userdata() {
|
||||||
|
log -i -t "$phase" notice "$ACTION: no user-data found"
|
||||||
|
}
|
||||||
|
|
||||||
|
INIT_ACTIONS_MAIN="missing_userdata ${INIT_ACTIONS_MAIN}"
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
# Unknown UserData Functions
|
# Unknown UserData Functions
|
||||||
# vim:set ts=4 et ft=sh:
|
# vim:set ts=4 et ft=sh:
|
||||||
|
|
||||||
# TODO: this would probably be mostly NOOPs
|
init__unknown_userdata() {
|
||||||
|
local type="$(userdata_type)"
|
||||||
|
log -i -t "$phase" warn "$ACTION: unable to process '$type' user-data"
|
||||||
|
}
|
||||||
|
|
||||||
|
INIT_ACTIONS_MAIN="unknown_userdata ${INIT_ACTIONS_MAIN}"
|
||||||
|
|||||||
@ -34,13 +34,12 @@ while true; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
complete) # indicate bootstrap is done
|
complete) # indicate bootstrap is done
|
||||||
init__bootstrap_complete
|
init__bootstrap_complete
|
||||||
log warn 'bootstrap marked complete';;
|
log -i notice 'bootstrap marked complete';;
|
||||||
incomplete) # indicate bootstrap isn't done
|
incomplete) # indicate bootstrap isn't done
|
||||||
bootstrap_incomplete
|
bootstrap_incomplete
|
||||||
log warn 'bootstrap marked incomplete';;
|
log -i warn 'bootstrap marked incomplete';;
|
||||||
*) usage >&2; exit 1;;
|
*) usage >&2; exit 1;;
|
||||||
esac
|
esac
|
||||||
printf ' bootstrap marked "%s"\n' "$1" >&2
|
|
||||||
exit 0;;
|
exit 0;;
|
||||||
-s|--setup) # just openrc for now
|
-s|--setup) # just openrc for now
|
||||||
for phase in -early -net '' -final; do
|
for phase in -early -net '' -final; do
|
||||||
@ -67,8 +66,7 @@ esac
|
|||||||
|
|
||||||
# is initial bootstrap already done?
|
# is initial bootstrap already done?
|
||||||
if [ -f "$TINY_CLOUD_VAR/.bootstrap-complete" ]; then
|
if [ -f "$TINY_CLOUD_VAR/.bootstrap-complete" ]; then
|
||||||
printf ' already bootstrapped\n' >&2
|
log -i -t "$phase" info "already bootstrapped"
|
||||||
log info "$phase - already bootstrapped"
|
|
||||||
exit 0;
|
exit 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -93,7 +91,7 @@ INIT_ACTIONS_FINAL="${INIT_ACTIONS_FINAL} bootstrap_complete"
|
|||||||
|
|
||||||
case "$phase" in
|
case "$phase" in
|
||||||
early) INIT_ACTIONS="$INIT_ACTIONS_EARLY";;
|
early) INIT_ACTIONS="$INIT_ACTIONS_EARLY";;
|
||||||
net) INIT_ACTIONS="$INIT_ACTIONS_NET";;
|
net) INIT_ACTIONS="$INIT_ACTIONS_NET";;
|
||||||
main) INIT_ACTIONS="$INIT_ACTIONS_MAIN";;
|
main) INIT_ACTIONS="$INIT_ACTIONS_MAIN";;
|
||||||
final) INIT_ACTIONS="$INIT_ACTIONS_FINAL";;
|
final) INIT_ACTIONS="$INIT_ACTIONS_FINAL";;
|
||||||
*) usage >&2; exit 1
|
*) usage >&2; exit 1
|
||||||
@ -101,23 +99,23 @@ esac
|
|||||||
|
|
||||||
for ACTION in $INIT_ACTIONS; do
|
for ACTION in $INIT_ACTIONS; do
|
||||||
if skip_action "$ACTION"; then
|
if skip_action "$ACTION"; then
|
||||||
printf '\n -- %s : [SKIP]' $ACTION >&2
|
printf '\n -- ' >&2
|
||||||
log warn "$phase - $ACTION - SKIPPED"
|
log -i -t "$phase" notice "$ACTION: skipped"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
printf '\n ++ %s ' $ACTION >&2
|
printf '\n ++ ' >&2
|
||||||
log info "$phase - $ACTION - START"
|
log -i -t "$phase" info "$ACTION"
|
||||||
RESULT="UNKNOWN"
|
RESULT="unknown"
|
||||||
LEVEL="err"
|
LEVEL="err"
|
||||||
if type "init__$ACTION" | grep -q -w "function"; then
|
if type "init__$ACTION" | grep -q -w "function"; then
|
||||||
if "init__$ACTION" "$@"; then
|
if "init__$ACTION" "$@"; then
|
||||||
RESULT="DONE"
|
RESULT="done"
|
||||||
LEVEL="info"
|
LEVEL="info"
|
||||||
else
|
else
|
||||||
RESULT="FAIL"
|
RESULT="failed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
printf ': [%s]' $RESULT >&2
|
printf ' ++ ' >&2
|
||||||
log "$LEVEL" "$phase - $ACTION - $RESULT"
|
log -i -t "$phase" "$LEVEL" "$ACTION: $RESULT"
|
||||||
done
|
done
|
||||||
echo >&2
|
echo >&2
|
||||||
|
|||||||
@ -49,7 +49,7 @@ expand_root_partition_body() {
|
|||||||
|
|
||||||
install_hotplugs_fail_body() {
|
install_hotplugs_fail_body() {
|
||||||
CLOUD=aws atf_check -s not-exit:0 \
|
CLOUD=aws atf_check -s not-exit:0 \
|
||||||
-e match:"vnic_eth_hotplug\(!\)" \
|
-e match:"vnic_eth_hotplug: failed" \
|
||||||
sh -c ". $lib; HOTPLUG_MODULES='vnic_eth_hotplug'; init__install_hotplugs"
|
sh -c ". $lib; HOTPLUG_MODULES='vnic_eth_hotplug'; init__install_hotplugs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,11 @@ userdata_type_body() {
|
|||||||
-o match:"unknown" \
|
-o match:"unknown" \
|
||||||
sh -c ". \"$lib\"; userdata_type"
|
sh -c ". \"$lib\"; userdata_type"
|
||||||
|
|
||||||
|
echo "#alpine-config" > var/lib/cloud/user-data
|
||||||
|
CLOUD="$c" atf_check \
|
||||||
|
-o match:"alpine-config" \
|
||||||
|
sh -c ". \"$lib\"; userdata_type"
|
||||||
|
|
||||||
echo "#!/bin/sh" > var/lib/cloud/user-data
|
echo "#!/bin/sh" > var/lib/cloud/user-data
|
||||||
CLOUD="$c" atf_check -s exit:0 \
|
CLOUD="$c" atf_check -s exit:0 \
|
||||||
-o match:"script" \
|
-o match:"script" \
|
||||||
|
|||||||
@ -80,6 +80,7 @@ save_userdata_compressed_body() {
|
|||||||
fake_userdata_nocloud < tmpfile
|
fake_userdata_nocloud < tmpfile
|
||||||
|
|
||||||
CLOUD="nocloud" atf_check \
|
CLOUD="nocloud" atf_check \
|
||||||
|
-e 'ignore' \
|
||||||
sh -c ". \"$lib\"; init__save_userdata"
|
sh -c ". \"$lib\"; init__save_userdata"
|
||||||
|
|
||||||
if ! grep "^#userdata" var/lib/cloud/user-data; then
|
if ! grep "^#userdata" var/lib/cloud/user-data; then
|
||||||
|
|||||||
@ -38,7 +38,7 @@ set_network_config_network_interfaces_body() {
|
|||||||
|
|
||||||
atf_check \
|
atf_check \
|
||||||
-o match:"rc-update" \
|
-o match:"rc-update" \
|
||||||
-e match:"set_network_interfaces .*DONE" \
|
-e match:"set_network_interfaces: done" \
|
||||||
tiny-cloud early
|
tiny-cloud early
|
||||||
atf_check \
|
atf_check \
|
||||||
-o match:"auto eth1" \
|
-o match:"auto eth1" \
|
||||||
@ -64,7 +64,7 @@ set_network_config_auto_body() {
|
|||||||
|
|
||||||
atf_check \
|
atf_check \
|
||||||
-o match:"rc-update" \
|
-o match:"rc-update" \
|
||||||
-e match:"set_network_interfaces .*DONE" \
|
-e match:"set_network_interfaces: done" \
|
||||||
tiny-cloud early
|
tiny-cloud early
|
||||||
atf_check \
|
atf_check \
|
||||||
-o match:"auto eth1" \
|
-o match:"auto eth1" \
|
||||||
@ -86,7 +86,7 @@ userdata_bootcmd_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_bootcmd .*DONE" \
|
-e match:"userdata_bootcmd: done" \
|
||||||
-o match:"^foo$" -o match:"^bar$" \
|
-o match:"^foo$" -o match:"^bar$" \
|
||||||
tiny-cloud main
|
tiny-cloud main
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ userdata_ntp_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_ntp .*DONE" \
|
-e match:"userdata_ntp: done" \
|
||||||
-o match:"apk add.*chrony" \
|
-o match:"apk add.*chrony" \
|
||||||
-o match:"rc-update .*chronyd" \
|
-o match:"rc-update .*chronyd" \
|
||||||
-o match:"rc-service .*chronyd" \
|
-o match:"rc-service .*chronyd" \
|
||||||
@ -115,7 +115,7 @@ userdata_ntp_busybox_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_ntp .*DONE" \
|
-e match:"userdata_ntp: done" \
|
||||||
-o not-match:"apk add" \
|
-o not-match:"apk add" \
|
||||||
-o match:"rc-update .*ntpd" \
|
-o match:"rc-update .*ntpd" \
|
||||||
-o match:"rc-service .*ntpd" \
|
-o match:"rc-service .*ntpd" \
|
||||||
@ -131,7 +131,7 @@ userdata_ntp_openntpd_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_ntp .*DONE" \
|
-e match:"userdata_ntp: done" \
|
||||||
-o match:"apk add.*openntpd" \
|
-o match:"apk add.*openntpd" \
|
||||||
-o match:"rc-update .*openntpd" \
|
-o match:"rc-update .*openntpd" \
|
||||||
-o match:"rc-service .*openntpd" \
|
-o match:"rc-service .*openntpd" \
|
||||||
@ -146,7 +146,7 @@ userdata_apk_cache_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_apk_cache .*DONE" \
|
-e match:"userdata_apk_cache: done" \
|
||||||
-o ignore \
|
-o ignore \
|
||||||
tiny-cloud main
|
tiny-cloud main
|
||||||
atf_check -o match:"$PWD/var/cache/apk" readlink -f etc/apk/cache
|
atf_check -o match:"$PWD/var/cache/apk" readlink -f etc/apk/cache
|
||||||
@ -162,7 +162,7 @@ userdata_apk_repositories_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_apk_repositories .*DONE" \
|
-e match:"userdata_apk_repositories: done" \
|
||||||
-o ignore \
|
-o ignore \
|
||||||
tiny-cloud main
|
tiny-cloud main
|
||||||
atf_check -o match:"^/srv/packages/main$" \
|
atf_check -o match:"^/srv/packages/main$" \
|
||||||
@ -181,7 +181,7 @@ userdata_apk_repositories_version_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_apk_repositories .*DONE" \
|
-e match:"userdata_apk_repositories: done" \
|
||||||
-o ignore \
|
-o ignore \
|
||||||
tiny-cloud main
|
tiny-cloud main
|
||||||
atf_check -o match:"^https://cdn.alpinelinux.org/edge/main$" \
|
atf_check -o match:"^https://cdn.alpinelinux.org/edge/main$" \
|
||||||
@ -202,7 +202,7 @@ userdata_apk_repositories_version_auto_edge_body() {
|
|||||||
|
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_apk_repositories .*DONE" \
|
-e match:"userdata_apk_repositories: done" \
|
||||||
-o ignore \
|
-o ignore \
|
||||||
tiny-cloud main
|
tiny-cloud main
|
||||||
atf_check -o match:"^https://cdn.alpinelinux.org/edge/main$" \
|
atf_check -o match:"^https://cdn.alpinelinux.org/edge/main$" \
|
||||||
@ -219,7 +219,7 @@ userdata_packages_body() {
|
|||||||
EOF
|
EOF
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_packages .*DONE" \
|
-e match:"userdata_packages: done" \
|
||||||
-o match:"apk add .*tmux" \
|
-o match:"apk add .*tmux" \
|
||||||
-o match:"apk add .*vim" \
|
-o match:"apk add .*vim" \
|
||||||
tiny-cloud main
|
tiny-cloud main
|
||||||
@ -235,7 +235,7 @@ userdata_runcmd_body() {
|
|||||||
# run net phase to extract the user data
|
# run net phase to extract the user data
|
||||||
atf_check -e ignore -o ignore tiny-cloud net
|
atf_check -e ignore -o ignore tiny-cloud net
|
||||||
atf_check \
|
atf_check \
|
||||||
-e match:"userdata_runcmd .*DONE" \
|
-e match:"userdata_runcmd: done" \
|
||||||
-o match:"^foo$" -o match:"^bar$" \
|
-o match:"^foo$" -o match:"^bar$" \
|
||||||
tiny-cloud final
|
tiny-cloud final
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ no_metadata_early_body() {
|
|||||||
fake_netcat
|
fake_netcat
|
||||||
for provider in $PROVIDERS; do
|
for provider in $PROVIDERS; do
|
||||||
CLOUD="$provider" atf_check \
|
CLOUD="$provider" atf_check \
|
||||||
-e not-match:"UNKNOWN" \
|
-e not-match:"unknown" \
|
||||||
-e not-match:"not found" \
|
-e not-match:"not found" \
|
||||||
-e not-match:"o such file" \
|
-e not-match:"o such file" \
|
||||||
-o match:"rc-update add.*sshd" \
|
-o match:"rc-update add.*sshd" \
|
||||||
@ -41,8 +41,8 @@ no_userdata_net_body() {
|
|||||||
fake_netcat
|
fake_netcat
|
||||||
for provider in $PROVIDERS; do
|
for provider in $PROVIDERS; do
|
||||||
CLOUD="$provider" atf_check \
|
CLOUD="$provider" atf_check \
|
||||||
-e not-match:"UNKNOWN" \
|
-e not-match:"unknown" \
|
||||||
-e match:"save_userdata.*DONE" \
|
-e match:"save_userdata.*done" \
|
||||||
tiny-cloud net
|
tiny-cloud net
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -53,7 +53,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:"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" \
|
||||||
tiny-cloud main
|
tiny-cloud main
|
||||||
@ -69,11 +69,11 @@ no_userdata_final_body() {
|
|||||||
fake_netcat
|
fake_netcat
|
||||||
for provider in $PROVIDERS; do
|
for provider in $PROVIDERS; do
|
||||||
CLOUD="$provider" atf_check \
|
CLOUD="$provider" atf_check \
|
||||||
-e not-match:"UNKNOWN" \
|
-e not-match:"unknown" \
|
||||||
-e match:"bootstrap_complete .*" \
|
-e match:"bootstrap_complete: done" \
|
||||||
tiny-cloud final
|
tiny-cloud final
|
||||||
CLOUD="$provider" atf_check \
|
CLOUD="$provider" atf_check \
|
||||||
-e match:"bootstrap marked.*incomplete" \
|
-e match:"bootstrap marked incomplete" \
|
||||||
tiny-cloud --bootstrap incomplete
|
tiny-cloud --bootstrap incomplete
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user