-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/ignition: check file ownership for system users
This ensure that entries in Ignition configuration can reference system users even if not present in ostree commit (e.g. `zincati).
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |