Skip to content

Commit

Permalink
tests/ignition: check file ownership for system users
Browse files Browse the repository at this point in the history
This ensure that entries in Ignition configuration can reference
system users even if not present in ostree commit (e.g. `zincati).

(cherry picked from commit dd25144)
  • Loading branch information
lucab authored and HuijingHei committed Oct 12, 2023
1 parent 42db380 commit c20d59f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/kola/ignition/sysusers/config.fcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
variant: fcos
version: 1.0.0
storage:
files:
- path: /etc/zincati/config.d/00-dummy-placeholder.toml
mode: 0644
user:
name: "zincati"
contents:
inline: |
# Dummy placeholder
20 changes: 20 additions & 0 deletions tests/kola/ignition/sysusers/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail

ok() {
echo "ok" "$@"
}

fatal() {
echo "$@" >&2
exit 1
}

TARGET="/etc/zincati/config.d/00-dummy-placeholder.toml"
OWNER=$(stat -c '%U' "${TARGET}")

# make sure the placeholder file is owned by the proper system user.
if test "${OWNER}" != 'zincati' ; then
fatal "unexpected owner of ${TARGET}: ${OWNER}"
fi
ok "placeholder file correctly owned by zincati user"

0 comments on commit c20d59f

Please sign in to comment.