Skip to content

Commit

Permalink
Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhammes committed Aug 25, 2024
1 parent df8666f commit 7ac7e27
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pyinfra_cli/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ def _is_inventory_group(key: str, value: Any):
# Ignore __builtins__/__file__
return False
elif key.startswith("_"):
logger.debug('Ignoring variable "%s" in inventory file since it starts with a leading underscore', key)
logger.debug(
'Ignoring variable "%s" in inventory file since it starts with a leading underscore',
key,
)
return False

if isinstance(value, list):
Expand All @@ -39,11 +42,19 @@ def _is_inventory_group(key: str, value: Any):
# Expand any generators of hosts
value = list(value)
else:
logger.debug('Ignoring variable "%s" in inventory file since it is not a list, tuple or generator expression', key)
logger.debug(
'Ignoring variable "%s" in inventory file since '
"it is not a list, tuple or generator expression",
key,
)
return False

if not all(isinstance(item, ALLOWED_HOST_TYPES) for item in value):
logger.warning('Ignoring host group "%s". Host groups may only contain strings (host) or tuples (host, data).', key)
logger.warning(
'Ignoring host group "%s". '
"Host groups may only contain strings (host) or tuples (host, data).",
key,
)
return False

return True
Expand Down

0 comments on commit 7ac7e27

Please sign in to comment.