-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: Add integration tests for scripts in ANTA documentation #1011
base: main
Are you sure you want to change the base?
Conversation
@@ -342,3 +342,33 @@ async def connect_inventory(self) -> None: | |||
if isinstance(r, Exception): | |||
message = "Error when refreshing inventory" | |||
anta_log_exception(r, message, logger) | |||
|
|||
def dump(self, path: Path) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AntaCatalog
class has a dump()
function that has a different signature and doing different stuff.
Let's aggree on an equivalent signature for the dump()
, yaml()
, and json()
functions.
Same for the ResultManager
it is another dump()
function returning a dict...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah not sure why I added this - this is a PR from a couple of months ago :p will need to re read
try: | ||
with path.open("w", encoding="UTF-8") as file: | ||
safe_dump( | ||
{AntaInventory.INVENTORY_ROOT_KEY: {"hosts": [safe_load(host.model_dump_json(serialize_as_any=True, exclude_unset=True)) for host in hosts]}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe get rid of INVENTORY_ROOT_KEY
and write the right pydantic model?
Description
Fixes #831
Checklist:
pre-commit run
)tox -e testenv
)