root/tags/v1.0/util.py

Revision 27, 386 bytes (checked in by daedalus, 4 years ago)

* Added 'authoritarian' mode, which allows you permit/deny each and every command

that will be issued to a remote device. Designed for testing new change scripts.

* Added a 'command_timeout' parameter to Command Provisioners, so you can override

the default command timeout of 300 seconds by setting an attribute in the config
file

* Added proper handling of the 'onfail: continue' idea. You can now specify that

if a change fails, and it is a pre-requisite for some other change, processing
will continue despite the failure.

* Added the onfail: retry feature. If a change fails, you can specify that it should

be retried. You can also set a max number of retries. The default is 3.

Line 
1#
2# Utility functions
3#
4import logging
5log = logging.getLogger('modipy')
6
7def substituteVariables(str, namespace={}):
8    """
9    Perform variable substitution, given a string and a namespace.
10    """
11    try:
12        str = str % namespace
13        return str
14    except KeyError, e:
15        log.error("Cannot perform substitution on string. KeyError on: %s, %s", str, e)
16        raise
17
Note: See TracBrowser for help on using the browser.