-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
imjournal: Add FileCreateMode module parameter
FileCreateMode allows to set the default file mode bits when creating new files. As of now, it has only impact on the state file. Add test suite as well. Minor indentation fix in run_journal.yml
- Loading branch information
Showing
3 changed files
with
68 additions
and
14 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
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
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,37 @@ | ||
#!/bin/bash | ||
# Test for checking the fileCreateMode imjournal parameter | ||
# Basically we set 3 different file creation modes for the state file | ||
# and test if those are really set | ||
# | ||
. ${srcdir:=.}/diag.sh init | ||
|
||
# $1 - the file create mode that we set for the state file | ||
test_imjournal_filecreatemode() { | ||
local EXPECTED=$1 | ||
|
||
generate_conf | ||
add_conf ' | ||
global(workDirectory="'$RSYSLOG_DYNNAME.spool'") | ||
module( | ||
load="../plugins/imjournal/.libs/imjournal" | ||
StateFile="imjournal.state" | ||
fileCreateMode="'$EXPECTED'" | ||
) | ||
' | ||
startup | ||
|
||
local ACTUAL="$(stat -c "%#a" "$RSYSLOG_DYNNAME.spool/imjournal.state")" | ||
if [ "$ACTUAL" != "$EXPECTED" ]; then | ||
echo "imjournal fileCreateMode failed, incorrect permissions on state file: expected($EXPECTED) != actual($ACTUAL)" | ||
error_exit | ||
fi | ||
shutdown_when_empty | ||
wait_shutdown | ||
ls -l "$RSYSLOG_DYNNAME.spool/imjournal.state" | ||
} | ||
|
||
test_imjournal_filecreatemode "0600" | ||
test_imjournal_filecreatemode "0640" | ||
test_imjournal_filecreatemode "0644" | ||
|
||
exit_test |