Messaging¶
pymco.message
¶
python-mcollective messaging objects.
-
class
pymco.message.
Filter
[source]¶ Provides MCollective filters for python-mcollective.
This class implements
collections.Mapping
interface, 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: self
so 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: self
so 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.MutableMapping
interface, 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.Config
instance. - filter –
Filter
instance. This parameter is optional. - kwargs – Extra keyword arguments. You can set the target
collective
or the messagettl
using them.
Raise: pymco.exc.ImproperlyConfigured
if configuration has noidentity
orcollective
is not set neither inkwargs
nor in configuration.