TT#47113 Change check of /var/log/debug

Merge 3 tests into one which is basically equivalent and simpler.  In
this way we reduce noise, since it shortens the file and often the
reported errors (when it fails it will often fail several of the
constraints at once), and errors are more direct and clear, reporting
this:

  File: /var/log/debug: mode: doesn't match, expect: ["0640"] found: ["0644"]

instead of:

  Command: find /var/log/ -type f -name debug ! -group adm: stdout: patterns not found: [!/./]

which tells you the current permissions deemed wrong or owner/group
used, so it's a bit more info to investigate.

Presumably this was done in a separate way because of thinking that the
"exists-or" didn't work or because sometimes files were created empty
without proper permissions, but this presumably solved now.

Change-Id: I77252743f0a204dffb838d4f7841e05689036c01
mr9.1
Manuel Montecelo 5 years ago
parent ad43da69cb
commit 3e894ebcc5

@ -42,6 +42,16 @@ file:
group: adm
filetype: file
/var/log/debug:
exists:
or:
- true
- false
mode: "0640"
owner: root
group: adm
filetype: file
/var/log/cron.log:
exists: true
mode: "0640"
@ -152,28 +162,3 @@ command:
- '!/./'
stderr:
- '!/./'
# optionally existing files
# /var/log/debug
"find /var/log/ -type f -name debug ! -user root":
exit-status: 0
stdout:
- '!/./'
stderr:
- '!/./'
"find /var/log/ -type f -name debug ! -group adm":
exit-status: 0
stdout:
- '!/./'
stderr:
- '!/./'
"find /var/log/ -type f -name debug ! -perm 640":
exit-status: 0
stdout:
- '!/./'
stderr:
- '!/./'

Loading…
Cancel
Save