Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pyinfra/facts/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ class SecurityLimits(FactBase):

@override
def command(self):
return "cat /etc/security/limits.conf"
return "cat /etc/security/limits.conf 2>/dev/null || true"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "cat /etc/security/limits.conf 2>/dev/null || true"
return "! test -e /etc/security/limits.conf || cat /etc/security/limits.conf"

This way we still catch errors calling cat which the || true method silently ignores.


default = list

Expand Down
2 changes: 1 addition & 1 deletion tests/facts/server.SecurityLimits/security_limits.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"command": "cat /etc/security/limits.conf",
"command": "cat /etc/security/limits.conf 2>/dev/null || true",
"output": [
"# <domain> <type> <item> <value>",
"#* soft core ",
Expand Down