NodeUtils

Cluster nodes utility module

The NodeUtils module is a ClusterShell helper module that provides supplementary services to manage nodes in a cluster. It is primarily designed to enhance the NodeSet module providing some binding support to external node groups sources in separate namespaces (example of group sources are: files, jobs scheduler, custom scripts, etc.).

class ClusterShell.NodeUtils.GroupSource(name, groups=None, allgroups=None)

ClusterShell Group Source class.

A Group Source object defines resolv_map, resolv_list, resolv_all and optional resolv_reverse methods for node group resolution. It is constituting a group resolution namespace.

__init__(name, groups=None, allgroups=None)

Initialize GroupSource

Parameters:
  • name -- group source name
  • groups -- group to nodes dict
  • allgroups -- optional _all groups_ result (string)
__weakref__

list of weak references to the object (if defined)

resolv_all()

Return the content of all groups as defined by this GroupSource

resolv_list()

Return a list of all group names for this group source

resolv_map(group)

Get nodes from group group

resolv_reverse(node)

Return the group name matching the provided node.

class ClusterShell.NodeUtils.GroupResolver(default_source=None, illegal_chars=None)

Base class GroupResolver that aims to provide node/group resolution from multiple GroupSources.

A GroupResolver object might be initialized with a default GroupSource object, that is later used when group resolution is requested with no source information. As of version 1.7, a set of illegal group characters may also be provided for sanity check (raising GroupResolverIllegalCharError when found).

__init__(default_source=None, illegal_chars=None)

Lazy initialization of a new GroupResolver object.

__weakref__

list of weak references to the object (if defined)

add_source(*args)

Add a GroupSource to this resolver.

all_nodes(namespace=None)

Find all nodes. You may specify an optional namespace.

default_source_name

Get default source name of resolver.

group_nodes(group, namespace=None)

Find nodes for specified group name and optional namespace.

grouplist(namespace=None)

Get full group list. You may specify an optional namespace.

has_node_groups(namespace=None)

Return whether finding group list for a specified node is supported by the resolver (in optional namespace).

node_groups(node, namespace=None)

Find group list for specified node and optional namespace.

set_verbosity(*args)

Set debugging verbosity value (DEPRECATED: use logging.DEBUG).

sources(*args)

Get the list of all resolver source names.

class ClusterShell.NodeUtils.GroupResolverConfig(filenames, illegal_chars=None)

GroupResolver class that is able to automatically setup its GroupSource's from a configuration file. This is the default resolver for NodeSet.

__init__(filenames, illegal_chars=None)

Lazy init GroupResolverConfig object from filenames.