Skip to content

Commit

Permalink
Merge pull request #108 from Renrut5/develop
Browse files Browse the repository at this point in the history
add enable threading option
  • Loading branch information
jvanderaa authored Sep 11, 2023
2 parents bff0ac4 + e5313d3 commit 711bfa0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nornir_nautobot/plugins/inventory/nautobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ def __init__( # pylint: disable=R0913
ssl_verify: Union[bool, None] = True,
filter_parameters: Union[Dict[str, Any], None] = None,
pynautobot_dict: Union[bool, None] = True,
enable_threading: Union[bool, None] = False,
) -> None:
"""Nautobot nornir class initialization."""
self.nautobot_url = nautobot_url or os.getenv("NAUTOBOT_URL")
self.nautobot_token = nautobot_token or os.getenv("NAUTOBOT_TOKEN")
self.filter_parameters = filter_parameters
self.ssl_verify = ssl_verify
self.pynautobot_dict = pynautobot_dict
self.enable_threading = enable_threading
self._verify_required()
self._api_session = None
self._devices = None
Expand Down Expand Up @@ -105,7 +107,11 @@ def pynautobot_obj(self) -> pynautobot.core.api.Api:
pynautobot object: Object to interact with the pynautobot SDK.
"""
if self._pynautobot_obj is None:
self._pynautobot_obj = pynautobot.api(self.nautobot_url, token=self.nautobot_token)
self._pynautobot_obj = pynautobot.api(
self.nautobot_url,
token=self.nautobot_token,
threading=self.enable_threading,
)
self._pynautobot_obj.http_session = self.api_session

return self._pynautobot_obj
Expand Down

0 comments on commit 711bfa0

Please sign in to comment.