Skip to content

Commit aa326b6

Browse files
LucaNicosiaddutt
authored andcommitted
fix device transport loading from inventory (#714)
* fix device transport loading Signed-off-by: LucaNicosia <[email protected]> * device transport fix pt2 Signed-off-by: LucaNicosia <[email protected]> * fix base source typo Signed-off-by: LucaNicosia <[email protected]>
1 parent d3a671e commit aa326b6

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

suzieq/poller/controller/source/base_source.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ def set_device(self, inventory: Dict[str, Dict]):
218218
f" at {jump_host_key_file} doesn't"
219219
" exists")
220220
transport = self._device.get('transport')
221+
if transport:
222+
# get the string from the enum
223+
transport = transport.value
221224
ignore_known_hosts = self._device.get('ignore-known-hosts', False)
222225
slow_host = self._device.get('slow-host', False)
223226
port = self._device.get('port')
@@ -244,7 +247,7 @@ def _validate_device(self):
244247
inv_fields = [x for x in self._device if x not in dev_fields]
245248
if inv_fields:
246249
raise InventorySourceError(
247-
f'{self._device.get("name")}: Unknow fields called '
250+
f'{self._device.get("name")}: Unknown fields called '
248251
f'{inv_fields}')
249252

250253

tests/unit/poller/controller/sources/test_devices.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import pytest
77
from suzieq.poller.controller.source.base_source import Source
8-
from suzieq.shared.exceptions import InventorySourceError
98
from suzieq.poller.controller.utils.inventory_utils import DeviceModel
9+
from suzieq.shared.utils import PollerTransport
1010

1111
# pylint: disable=protected-access
1212

@@ -66,7 +66,7 @@ async def test_devices_set(inventory: Dict):
6666
'jump-host': None,
6767
'jump-host-key-file': None,
6868
'devtype': 'panos',
69-
'transport': 'ssh',
69+
'transport': PollerTransport.ssh,
7070

7171
}
7272
}

0 commit comments

Comments
 (0)