Skip to content

Commit 5283d43

Browse files
dduttclaudious96
authored andcommitted
poller controller: pylint fixup
Signed-off-by: Dinesh Dutt <[email protected]>
1 parent 9790aab commit 5283d43

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

suzieq/poller/controller/source/ansible.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class AnsibleSourceModel(SourceModel):
2323
def validate_and_set(cls, path: str):
2424
"""checks if the path is valid
2525
"""
26+
inventory = None
2627
if isinstance(path, str):
2728
if not Path(path).is_file():
2829
raise ValueError(
@@ -38,6 +39,10 @@ def validate_and_set(cls, path: str):
3839

3940
elif isinstance(path, Dict):
4041
inventory = path
42+
43+
if not inventory:
44+
raise ValueError('Unknown inventory format: expect path or dict')
45+
4146
if '_meta' not in inventory \
4247
or 'hostvars' not in inventory['_meta']:
4348
if isinstance(inventory, list) and 'namespace' in inventory[0]:

0 commit comments

Comments
 (0)