Configuration¶
pymco.config
¶
Provides MCollective configuration parsing and an entry point for getting the right plugin classes.
-
class
pymco.config.
Config
(configdict, logger=<logging.Logger object>)[source]¶ python-mcollective confiugration class.
Parameters: configdict (dict) – a dictionary like object containing configuration as key values. -
static
from_configfile
(configfile)[source]¶ Reads configfile and returns a new
Config
instanceParameters: configfile – path to the configuration file to be parsed. Returns: Config
instance.
-
static
from_configstr
(configstr, section='default')[source]¶ Parses given string an returns a new
Config
instanceParameters: - configstr – configuration file content as string.
- section – dummy section to be used for parsing configuration as INI file.
Returns: Config
instance.
-
get_conn_params
()[source]¶ Get STOMP connection parameters for current configuration.
Returns: Dictionary with stomp.py connection like key/values.
-
get_host_and_ports
()[source]¶ Get all hosts and port pairs for the current configuration.
The result must follow the
stomp.Connection
host_and_ports
parameter.Returns: Iterable of two-tuple where the first element is the host and the second is the port.
-
get_ssl_params
()[source]¶ Get SSL configuration for current connector
Returns: An iterable of SSL configuration parameters to be used with stomp.Transport.set_ssl()
.
-
get_user_and_password
(current_host_and_port=None)[source]¶ Get the user and password for the current host and port.
Parameters: current_host_and_port – two-tuple iterable where the first element is the host and second is the port. This parameter is not required for
pymco.connector.stomp.StompConnector
connector.Returns: Two-tuple where the first element is the user and the second is the password for the given host and port.
Raises: - ValueError – if connector isn’t
stomp
andhost_and_port
is not provided. - pymco.exc.ConfigLookupError – if host and port are not found into the connector list of host and ports.
- ValueError – if connector isn’t
-
static
-
pymco.config.
INFINITE
¶ Constant used for trying middleware connections indefinitely.