deploy: Ignore sockets, fifos in /etc during merge
https://bugzilla.redhat.com/show_bug.cgi?id=1945274 is an issue where a privileged kubernetes daemonset is writing a socket into `/etc`. This makes ostree upgrades barf. Now, they should clearly move it to `/run`. However, one option is for us to just ignore it instead of erroring out. Some brief investigation shows that e.g. `git add somesocket` is a silent no-op, which is an argument in favor of ignoring it. Closes: https://github.com/ostreedev/ostree/issues/2446
This commit is contained in:
parent
5bf4b1dabc
commit
e6a560b407
|
|
@ -488,9 +488,7 @@ copy_modified_config_file (int orig_etc_fd,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return glnx_throw (error,
|
ot_journal_print (LOG_INFO, "Ignoring non-regular/non-symlink file found during /etc merge: %s", path);
|
||||||
"Unsupported non-regular/non-symlink file in /etc '%s'",
|
|
||||||
path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,23 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
|
||||||
test -f /run/systemd/generator/multi-user.target.wants/ostree-finalize-staged.path
|
test -f /run/systemd/generator/multi-user.target.wants/ostree-finalize-staged.path
|
||||||
test -f /run/systemd/generator/local-fs.target.requires/ostree-remount.service
|
test -f /run/systemd/generator/local-fs.target.requires/ostree-remount.service
|
||||||
|
|
||||||
|
cat >/etc/systemd/system/sock-to-ignore.socket << 'EOF'
|
||||||
|
[Socket]
|
||||||
|
ListenStream=/etc/sock-to-ignore
|
||||||
|
EOF
|
||||||
|
cat >/etc/systemd/system/sock-to-ignore.service << 'EOF'
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/cat
|
||||||
|
EOF
|
||||||
|
# policy denies systemd listening on a socket in /etc (arguably correctly)
|
||||||
|
setenforce 0
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl start --now sock-to-ignore.socket
|
||||||
|
setenforce 1
|
||||||
|
|
||||||
|
test -S /etc/sock-to-ignore
|
||||||
|
mkfifo /etc/fifo-to-ignore
|
||||||
|
|
||||||
# Initial cleanup to handle the cosa fast-build case
|
# Initial cleanup to handle the cosa fast-build case
|
||||||
## TODO remove workaround for https://github.com/coreos/rpm-ostree/pull/2021
|
## TODO remove workaround for https://github.com/coreos/rpm-ostree/pull/2021
|
||||||
mkdir -p /var/lib/rpm-ostree/history
|
mkdir -p /var/lib/rpm-ostree/history
|
||||||
|
|
@ -54,6 +71,9 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
|
||||||
# Assert that the previous boot had a journal entry for it
|
# Assert that the previous boot had a journal entry for it
|
||||||
journalctl -b "-1" -u ostree-finalize-staged.service > svc.txt
|
journalctl -b "-1" -u ostree-finalize-staged.service > svc.txt
|
||||||
assert_file_has_content svc.txt 'Bootloader updated; bootconfig swap: yes;.*deployment count change: 1'
|
assert_file_has_content svc.txt 'Bootloader updated; bootconfig swap: yes;.*deployment count change: 1'
|
||||||
|
# Also validate ignoring socket and fifo
|
||||||
|
assert_file_has_content svc.txt 'Ignoring.*during /etc merge:.*sock-to-ignore'
|
||||||
|
assert_file_has_content svc.txt 'Ignoring.*during /etc merge:.*fifo-to-ignore'
|
||||||
rm -f svc.txt
|
rm -f svc.txt
|
||||||
# And there should not be a staged deployment
|
# And there should not be a staged deployment
|
||||||
test '!' -f /run/ostree/staged-deployment
|
test '!' -f /run/ostree/staged-deployment
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,9 @@ chmod 700 ${etc}/a/long/dir/forking
|
||||||
# Symlink to nonexistent path, to ensure we aren't walking symlinks
|
# Symlink to nonexistent path, to ensure we aren't walking symlinks
|
||||||
ln -s no-such-file ${etc}/a/link-to-no-such-file
|
ln -s no-such-file ${etc}/a/link-to-no-such-file
|
||||||
|
|
||||||
|
# fifo which should be ignored
|
||||||
|
mkfifo "${etc}/fifo-to-ignore"
|
||||||
|
|
||||||
# Remove a directory
|
# Remove a directory
|
||||||
rm ${etc}/testdirectory -rf
|
rm ${etc}/testdirectory -rf
|
||||||
|
|
||||||
|
|
@ -66,6 +69,10 @@ newetc=${newroot}/etc
|
||||||
assert_file_has_content ${newroot}/usr/etc/NetworkManager/nm.conf "a default daemon file"
|
assert_file_has_content ${newroot}/usr/etc/NetworkManager/nm.conf "a default daemon file"
|
||||||
assert_file_has_content ${newetc}/NetworkManager/nm.conf "a modified config file"
|
assert_file_has_content ${newetc}/NetworkManager/nm.conf "a modified config file"
|
||||||
|
|
||||||
|
if test -e "${newetc}"/fifo-to-ignore; then
|
||||||
|
fatal "Should not have copied fifo!"
|
||||||
|
fi
|
||||||
|
|
||||||
assert_file_has_mode() {
|
assert_file_has_mode() {
|
||||||
stat -c '%a' $1 > mode.txt
|
stat -c '%a' $1 > mode.txt
|
||||||
if ! grep -q -e "$2" mode.txt; then
|
if ! grep -q -e "$2" mode.txt; then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue