devices¶
Devices module.
-
class
homer.devices.
Device
(fqdn, metadata, config, private)¶ Bases:
tuple
Create new instance of Device(fqdn, metadata, config, private)
-
property
config
¶ Alias for field number 2
-
property
fqdn
¶ Alias for field number 0
-
property
metadata
¶ Alias for field number 1
-
property
private
¶ Alias for field number 3
-
property
-
class
homer.devices.
Devices
(devices: Mapping[str, Mapping[str, str]], devices_config: Mapping[str, Mapping], private_config: Optional[Mapping[str, Mapping]] = None)[source]¶ Bases:
collections.UserDict
Collection of devices, accessible by FQDN as a dict or role and site via dedicated accessors.
Initialize the instance.
- Parameters
devices (dict) -- the devices configuration with FQDN as key and a dictionary with the device metadata as value.
devices_config (dict) -- the devices configuration with FQDN as key and a dictionary with the device-specific configuration as value.
private_config (dict, optional) -- an optional dictionary of the devices private configuration with the FQDN as key and a dictionary of device-specific private configuration as value. It cannot have top level keys in common with the same device public configuration.
-
query
(query_string: str) → List[homer.devices.Device][source]¶ Get the devices matching the query.
Todo
If needed, expand the query capabilities with a proper syntax using pyparsing.
- Parameters
query_string (str) -- the query_string to use to filter for.
- Raises
homer.exceptions.HomerError -- on invalid query.
- Returns
a list of Device objects.
- Return type