Skip to content

Commit

Permalink
fix(anta): Quickfix for AVD integration (#228)
Browse files Browse the repository at this point in the history
Quickfix in setup_logging() to handle AVD integration
  • Loading branch information
mtache authored Jun 27, 2023
1 parent 0b5add2 commit 1777074
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions anta/inventory/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ def __dict__(self) -> dict[str, Any]:
"tags": self.tags,
"is_online": self.is_online,
"established": self.established,
"session": vars(self._session),
"ssh_options": vars(self._ssh_opts),
"_session": vars(self._session),
"_ssh_opts": vars(self._ssh_opts),
}

def __eq__(self, other: object) -> bool:
Expand Down Expand Up @@ -389,6 +389,7 @@ async def refresh(self) -> None:
else:
logger.warning(f"Could not connect to device {self.name}: cannot open eAPI port")
self.established = bool(self.is_online and self.hw_model)
logger.debug(pretty_repr(vars(self)))

async def copy(self, sources: List[Path], destination: Path, direction: Literal["to", "from"] = "from") -> None:
"""
Expand Down
9 changes: 4 additions & 5 deletions anta/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ def setup_logging(level: str = logging.getLevelName(logging.INFO)) -> None:
level (str, optional): level name to configure.
"""
root = logging.getLogger()
if not root.hasHandlers():
handler = RichHandler()
formatter = logging.Formatter(fmt="%(name)s - %(message)s", datefmt="[%X]")
handler.setFormatter(formatter)
root.addHandler(handler)
handler = RichHandler()
formatter = logging.Formatter(fmt="%(name)s - %(message)s", datefmt="[%X]")
handler.setFormatter(formatter)
root.addHandler(handler)
loglevel = getattr(logging, level.upper())
root.setLevel(loglevel)
if loglevel == logging.INFO:
Expand Down

0 comments on commit 1777074

Please sign in to comment.