Skip to content
Draft
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
6 changes: 6 additions & 0 deletions sssd_test_framework/hosts/ad.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ def restore(self, backup_data: Any | None) -> None:
}}
}}

# Clean up certificate directories
if (Test-Path "C:\pki") {{
Write-Host "Cleaning up certificate directories in C:\pki"
Remove-Item "C:\pki" -Recurse -Force -ErrorAction SilentlyContinue
}}

# If we got here, make sure we exit with 0
Exit 0
""",
Expand Down
26 changes: 26 additions & 0 deletions sssd_test_framework/misc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,29 @@ def get_attr(data: dict[str, Any], key: str, default: Any | None = None) -> Any
return default
return value[0] if len(value) == 1 else value
return value


def parse_cert_info(output: str) -> dict[str, list[str]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a small unit test to sssd_test_framework/tests/test_misc.py

"""
Parse certutil output into dictionary.

:param output: certutil output.
:type output: str
:returns: Dictionary of certificate attributes.
:rtype: dict[str, list[str]]
"""
lines = [line.strip() for line in (output or "").splitlines() if line.strip()]
return attrs_parse(lines)


def parse_ad_object_info(output: str) -> dict[str, list[str]]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same, small unit test, these tests will run every time tox is executed.

"""
Parse AD object output into dictionary.

:param output: PowerShell AD object output.
:type output: str
:returns: Dictionary of AD object attributes.
:rtype: dict[str, list[str]]
"""
lines = [line.strip() for line in (output or "").splitlines() if line.strip()]
return attrs_parse(lines)
Loading
Loading