Skip to content
Merged
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: 2 additions & 0 deletions library/scan_sudoers.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ def get_includes(path):

def get_config_lines(path, params):
# Read sudoers file
if not isfile(path):
return {}
fp = open(path, "r")
all_lines = fp.read()
fp.close()
Expand Down
2 changes: 2 additions & 0 deletions meta/collection-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
---
collections:
- name: ansible.posix
- name: community.general

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One question, why you added community general to the list of reqs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

version: ">=6.6.0,<12.0.0"
1 change: 1 addition & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ galaxy_info:
- el9
- el10
- fedora
- leap
- container
- containerbuild
dependencies: []
6 changes: 4 additions & 2 deletions tests/unit/test_scan_sudoers.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ def test_get_user_specs15(self):
"scan_sudoers.get_includes",
return_value={"include_files": ["/etc/sudoers.d/file1"]},
)
def test_get_config_lines01(self, mock_open, mock_get_includes):
@patch("scan_sudoers.isfile", return_value=True)
def test_get_config_lines01(self, mock_isfile, mock_open, mock_get_includes):
Comment thread
richm marked this conversation as resolved.
# Arrange

params = {"output_raw_configs": True, "output_parsed_configs": True}
Expand Down Expand Up @@ -395,7 +396,8 @@ def test_get_config_lines01(self, mock_open, mock_get_includes):
"scan_sudoers.get_includes",
return_value={"include_files": ["/etc/sudoers.d/file1"]},
)
def test_get_config_lines02(self, mock_open, mock_get_includes):
@patch("scan_sudoers.isfile", return_value=True)
def test_get_config_lines02(self, mock_isfile, mock_open, mock_get_includes):
# Arrange
params = {"output_raw_configs": True, "output_parsed_configs": True}
expected_output = {
Expand Down
Loading