Module NodeSet
source code
Cluster node set module.
A module to efficiently deal with node sets and node groups. Instances
of NodeSet provide similar operations than the builtin set() type, see
http://www.python.org/doc/lib/set-objects.html
Usage example
>>>
... from ClusterShell.NodeSet import NodeSet
>>>
>>>
... nodeset = NodeSet("cluster[1-30]")
>>>
... nodeset.update("cluster32")
>>>
... nodeset.difference_update("cluster[2-5,8-31]")
>>>
... print nodeset
cluster[1,6-7,32]
>>>
... for node in nodeset:
... print node
cluster1
cluster6
cluster7
cluster32
|
_strip_escape(nsstr)
Helper to prepare a nodeset string for parsing: trim boundary
whitespaces and escape special characters. |
source code
|
|
|
expand(pat)
Commodity function that expands a nodeset pattern into a list of
nodes. |
source code
|
|
|
fold(pat)
Commodity function that clean dups and fold provided pattern with
ranges and "/step" support. |
source code
|
|
|
grouplist(namespace=None,
resolver=None)
Commodity function that retrieves the list of raw groups for a
specified group namespace (or use default namespace). |
source code
|
|
|
std_group_resolver()
Get the current resolver used for standard "@" group
resolution. |
source code
|
|
|
|
|
DEF_GROUPS_CONFIGS = [ ' /etc/clustershell/groups.conf ' , ' /home/ ...
|
|
ILLEGAL_GROUP_CHARS = set([ ' ! ' , ' & ' , ' * ' , ' , ' , ' @ ' , ' ^ ' ])
|
|
_DEF_RESOLVER_STD_GROUP = NodeUtils.GroupResolverConfig(DEF_GR...
|
|
RESOLVER_STD_GROUP = NodeUtils.GroupResolverConfig(DEF_GROUPS_...
|
|
RESOLVER_NOGROUP = -1
|
|
RESOLVER_NOINIT = -2
|
|
STD_GROUP_RESOLVER = NodeUtils.GroupResolverConfig(DEF_GROUPS_...
|
|
NOGROUP_RESOLVER = -1
|
|
__package__ = ' ClusterShell '
|
Commodity function that retrieves the list of raw groups for a
specified group namespace (or use default namespace). Group names are not
prefixed with "@".
|
Override the resolver used for standard "@" group
resolution. The new resolver should be either an instance of
NodeUtils.GroupResolver or None. In the latter case, the group resolver
is restored to the default one.
|
DEF_GROUPS_CONFIGS
- Value:
[ ' /etc/clustershell/groups.conf ' ,
' /home/sthiell/.local/etc/clustershell/groups.conf ' ,
' /home/sthiell/.config/clustershell/groups.conf ' ]
|
|
_DEF_RESOLVER_STD_GROUP
- Value:
NodeUtils.GroupResolverConfig(DEF_GROUPS_CONFIGS, ILLEGAL_GROUP_CHARS)
|
|
RESOLVER_STD_GROUP
- Value:
NodeUtils.GroupResolverConfig(DEF_GROUPS_CONFIGS, ILLEGAL_GROUP_CHARS)
|
|
STD_GROUP_RESOLVER
- Value:
NodeUtils.GroupResolverConfig(DEF_GROUPS_CONFIGS, ILLEGAL_GROUP_CHARS)
|
|