Messaging¶
pymco.message¶
python-mcollective messaging objects.
-
class
pymco.message.Filter[source]¶ Provides MCollective filters for python-mcollective.
This class implements
collections.Mappinginterface, so it can be used as non mutable mapping (read only dict), but mutable using provided add methods. So that, for adding the agent you can just useadd_agent():filter.add_agent('package')
-
add_agent(agent)[source]¶ Add new MCollective agent
Parameters: agent – MCollective agent name. Returns: selfso filters can be chained.
-
add_cfclass(name)[source]¶ Add new class applied by your configuration management system.
Roles, cookbooks,... names may be used too.
Parameters: name – class, role, cookbook,... name. Returns: selfso filters can be chained.
-
-
class
pymco.message.Message(body, agent, config, filter_=None, **kwargs)[source]¶ Provides MCollective messages for python-mcollective.
This class implements
collections.MutableMappinginterface, so it can be used as read/write mapping (dictionary).Parameters: - body – the message body. It must be serializable using current serialization method.
- agent – message target agent.
- config –
pymco.config.Configinstance. - filter –
Filterinstance. This parameter is optional. - kwargs – Extra keyword arguments. You can set the target
collectiveor the messagettlusing them.
Raise: pymco.exc.ImproperlyConfiguredif configuration has noidentityorcollectiveis not set neither inkwargsnor in configuration.