Package ClusterShell :: Module NodeUtils :: Class UpcallGroupSource
[hide private]
[frames] | no frames]

Class UpcallGroupSource

source code


GroupSource class managing external calls for nodegroup support.

Upcall results are cached for a customizable amount of time. This is controlled by `cache_time` attribute. Default is 3600 seconds.

Instance Methods [hide private]
 
__init__(self, name, map_upcall, all_upcall=None, list_upcall=None, reverse_upcall=None, cfgdir=None, cache_time=None)
Initialize GroupSource
source code
 
clear_cache(self)
Remove all previously cached upcall results whatever their lifetime is.
source code
 
_upcall_read(self, cmdtpl, args={})
Invoke the specified upcall command, raise an Exception if something goes wrong and return the command output otherwise.
source code
 
_upcall_cache(self, upcall, cache, key, **args)
Look for `key' in provided `cache'.
source code
 
resolv_map(self, group)
Get nodes from group 'group', using the cached value if available.
source code
 
resolv_list(self)
Return a list of all group names for this group source, using the cached value if available.
source code
 
resolv_all(self)
Return the content of special group ALL, using the cached value if available.
source code
 
resolv_reverse(self, node)
Return the group name matching the provided node, using the cached value if available.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, map_upcall, all_upcall=None, list_upcall=None, reverse_upcall=None, cfgdir=None, cache_time=None)
(Constructor)

source code 

Initialize GroupSource

:param name: group source name :param groups: group to nodes dict :param allgroups: optional _all groups_ result (string)

Overrides: object.__init__
(inherited documentation)

_upcall_cache(self, upcall, cache, key, **args)

source code 

Look for `key' in provided `cache'. If not found, call the corresponding `upcall'.

If `key' is missing, it is added to provided `cache'. Each entry in a cache is kept only for a limited time equal to self.cache_time .

resolv_map(self, group)

source code 

Get nodes from group 'group', using the cached value if available.

Overrides: GroupSource.resolv_map

resolv_list(self)

source code 

Return a list of all group names for this group source, using the cached value if available.

Overrides: GroupSource.resolv_list

resolv_all(self)

source code 

Return the content of special group ALL, using the cached value if available.

Overrides: GroupSource.resolv_all

resolv_reverse(self, node)

source code 

Return the group name matching the provided node, using the cached value if available.

Overrides: GroupSource.resolv_reverse