-
-
Notifications
You must be signed in to change notification settings - Fork 452
Open
Description
This was added in ed8196d; there are no docs (fair enough, it's experimental) but I feel like this simplifying use-case of
inventory_module.host_groupwould be beneficial. Consider the followinginventory.pycontents:proxmox_hosts = ["pve01", "pve02", "pve03"] access_points = ["unifi01", "unifi02", "unifi03"]It would be nice to use
pyinfra inventory.proxmox_hosts deploy.pyinstead of the more verbose and potentially more error pronepyinfra inventory.py deploy.py --limit proxmox_hosts.Currently the code assumes that this argv syntax always refers to a callable, I think checking if the user parameter is an iterable would be a reasonably simple addition and would enhance UX.
pyinfra/pyinfra_cli/inventory.py
Lines 134 to 143 in 511e7c3
def make_inventory_from_func( inventory_func: Callable[[], Dict[str, List[HostType]]], override_data: Optional[Dict[Any, Any]] = None, ): logger.warning("Loading inventory via import function is in alpha!") try: groups = inventory_func() except Exception as e: raise CliError(f"Failed to load inventory function: {inventory_func.__name__}: {e}")
Originally posted by @mechanarchy in #959
Metadata
Metadata
Assignees
Labels
No labels