The Assimilation Project  based on Assimilation version 1.1.7.1474836767
cma.graphnodeexpression Namespace Reference

Data Structures

class  ExpressionContext
 
class  GraphNodeExpression
 

Functions

def IGNORE (_ignoreargs, _ignorecontext)
 
def EQ (args, _context)
 
def NE (args, _context)
 
def LT (args, _context)
 
def GT (args, _context)
 
def LE (args, _context)
 
def GE (args, _context)
 
def IN (args, _context)
 
def NOTIN (args, _context)
 
def NOT (args, _context)
 
def match (args, _context)
 
def argequals (args, context)
 
def argmatch (args, context)
 
def flagvalue (args, context)
 
def OR (args, context)
 
def AND (args, context)
 
def ATTRSEARCH (args, context)
 
def FINDATTRVALUE (args, _context)
 
def PAMMODARGS (args, _context)
 
def MUST (args, _unused_context)
 
def NONEOK (args, _unused_context)
 
def FOREACH (args, context)
 
def bitwiseOR (args, context)
 
def bitwiseAND (args, context)
 
def is_upstartjob (args, context)
 
def selectanipport (arg, _context, preferlowestport=True, preferv4=True)
 
def serviceip (args, context)
 
def serviceport (args, context)
 
def serviceipport (args, context)
 
def basename (args, context)
 
def dirname (args, context)
 
def hascmd (args, context)
 
def simpletests ()
 
def contexttests ()
 

Variables

 ipportregex = re.compile('(.*):([^:]*)$')
 

Function Documentation

def cma.graphnodeexpression.AND (   args,
  context 
)
A function which evaluates  each expression in turn, and returns the value
of the first expression which is not None - or None

Definition at line 699 of file graphnodeexpression.py.

def cma.graphnodeexpression.argequals (   args,
  context 
)
usage: argequals  name-to-search-for [list-to-search]

A function which searches a list for an argument of the form name=value.
The value '$argv' is the default name of the list to search.
If there is a second argument, then that second argument is an expression
expected to yield an iterable to search in for the name=value string instead of '$argv'

Definition at line 564 of file graphnodeexpression.py.

def cma.graphnodeexpression.argmatch (   args,
  context 
)
usage: argmatch regular-expression [list-to-search [regex-flags]]

Argmatch searches a list for an value that matches a given regex.
The regular expression is given by the argument in args, and the list 'argv'
defaults to be the list of arguments to be searched.

If there are two arguments in args, then the first argument is the
array value to search in for the regular expression string instead of 'argv'

If the regex contains a parenthesized groups, then the value of the first such group
is returned, otherwise the part of the argument that matches the regex is returned.

Note that this regular expression is 'anchored' that is, it starts with the first character
in the argument. If you want it to be floating, then you may want to start your regex
with '.*' and possibly parenthesize the part you want to return.

Definition at line 594 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.contexttests().

Here is the caller graph for this function:

def cma.graphnodeexpression.ATTRSEARCH (   args,
  context 
)
Search our first context object for an attribute with the given name and (if supplied) value.
If 'value' is None, then we simply search for the given name.
We return True if we found what we were looking for, and False otherwise.

The object to search in is is args[0], the name is args[1],
and the optional desired value is args[2].

Definition at line 719 of file graphnodeexpression.py.

References cma.graphnodeexpression.FINDATTRVALUE().

Here is the call graph for this function:

def cma.graphnodeexpression.basename (   args,
  context 
)
This function returns the basename from a pathname.
If no pathname is supplied, then the executable name is assumed.

Definition at line 1102 of file graphnodeexpression.py.

Referenced by _discovery_sendjson(), and cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.bitwiseAND (   args,
  context 
)
A function which evaluates the each expression and returns the bitwise AND of
all the expressions given as arguments

Definition at line 942 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.bitwiseOR (   args,
  context 
)
A function which evaluates the each expression and returns the bitwise OR of
all the expressions given as arguments

Definition at line 926 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.contexttests ( )

Definition at line 1203 of file graphnodeexpression.py.

References cma.graphnodeexpression.argmatch(), cma.graphnodeexpression.FOREACH(), and cma.graphnodeexpression.simpletests().

Here is the call graph for this function:

def cma.graphnodeexpression.dirname (   args,
  context 
)
This function returns the directory name from a pathname.
If no pathname is supplied, then the discovered service executable name is assumed.

Definition at line 1122 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.EQ (   args,
  _context 
)
Function to return True if each non-None argument in the list matches
every non-None argument and at least one of its subsequent arguments are not None.

Definition at line 353 of file graphnodeexpression.py.

References cma.drawwithdot.type.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.FINDATTRVALUE (   args,
  _context 
)
Search our first context object for an attribute with the given name and (if supplied) value.
We return the value found, if it is in the context objects, or None if it is not
If 'value' is None, then we simply search for the given name.

We return True if the desired value is None, and so is the value we found -
otherwise we return the value associated with 'name' or None if not found.

The object to search in is is args[0], the name is args[1],
and the optional desired value is args[2].

Definition at line 733 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.ATTRSEARCH().

Here is the caller graph for this function:

def cma.graphnodeexpression.flagvalue (   args,
  context 
)
usage: flagvalue flag-name [list-to-search]
A function which searches a list for a -flag and returns
the value of the string which is the next argument.
The -flag is given by the argument in args, and the list 'argv'
is assumed to be the list of arguments.
If there are two arguments in args, then the first argument is the
array value to search in for the -flag string instead of 'argv'
The flag given must be the entire flag complete with - character.
For example -X or --someflag.

Definition at line 646 of file graphnodeexpression.py.

def cma.graphnodeexpression.FOREACH (   args,
  context 
)
Applies the (string) expression (across all values in the context,
returning the 'AND' of the evaluation of the expression-evaluations
across the top level values in the context. It stops evaluation on
the first False return.

The final argument is the expression (predicate) to be evaluated. Any
previous arguments in 'args' are expressions to be evaluated in the context
'context' then used as the 'context' for this the expression in this FOREACH.
Note that this desired predicate is a _string_, which is then evaluated
(like 'eval').  It is not a normal expression, but a string containing
an expression.  You _will_ have to quote it.

When given a single argument, it will evaluate the string expression
for each of  top-level values in the object. Normally this would be the 'data'
portion of a discovery object. So, for example, if each of the top level keys
is a file name and the values are file properties, then it will evaluate the
expression on the properties of every file in the object.

If you need to evaluate this across all the elements of a sub-object named
"filenames" in the top level "data" object then you give "$filenames" as the
context argument, and your predicate as the expression like this:
    ["$filenames", "<your-desired-predicate>"].

The code to do this is simpler than the explanation ;-)

Definition at line 868 of file graphnodeexpression.py.

References cma.drawwithdot.type.

Referenced by cma.graphnodeexpression.contexttests().

Here is the caller graph for this function:

def cma.graphnodeexpression.GE (   args,
  _context 
)
Function to return True if each non-None argument in the list is
greater than or equal to first one or None if all subsequent arguments are None

Definition at line 441 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.GT (   args,
  _context 
)
Function to return True if each non-None argument in the list is
greater than the first one or None if all subsequent arguments are None

Definition at line 409 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.hascmd (   args,
  context 
)
This function returns True if the given list of commands are all present on the given Drone.
It determines this by looking at the value of $_init_commands.data

Definition at line 1139 of file graphnodeexpression.py.

def cma.graphnodeexpression.IGNORE (   _ignoreargs,
  _ignorecontext 
)
Function to ignore its argument(s) and return True all the time.
This is a special kind of no-op in that it is used to override
and ignore an underlying rule. It is expected that its arguments
will explain why it is being ignored in this rule set.

Definition at line 344 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.IN (   args,
  _context 
)
Function to return True if first argument is in the list that follows.
If the first argument is iterable, then each element in it must be 'in'
the list that follows.

Definition at line 457 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.is_upstartjob (   args,
  context 
)
Returns "true" if any of its arguments names an upstart job, "false" otherwise
If no arguments are given, it returns whether this system has upstart enabled.

Definition at line 958 of file graphnodeexpression.py.

def cma.graphnodeexpression.LE (   args,
  _context 
)
Function to return True if each non-None argument in the list is
less than or equal to first one or None if all subsequent arguments are None

Definition at line 425 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.LT (   args,
  _context 
)
Function to return True if each non-None argument in the list is
less than the first one or None if all subsequent arguments are None

Definition at line 393 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.match (   args,
  _context 
)
Function to return True if first argument matches the second argument (a regex)
- optional 3rd argument is RE flags

Definition at line 552 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.MUST (   args,
  _unused_context 
)

Definition at line 843 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.NE (   args,
  _context 
)
Function to return True if no non-None argument in the list matches
the first one or None if all subsequent arguments are None

Definition at line 375 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.NONEOK (   args,
  _unused_context 
)

Definition at line 856 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.NOT (   args,
  _context 
)

Definition at line 497 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.NOTIN (   args,
  _context 
)

Definition at line 483 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.simpletests().

Here is the caller graph for this function:

def cma.graphnodeexpression.OR (   args,
  context 
)
A function which evaluates  each expression in turn, and returns the value
of the first expression which is not None - or None

Definition at line 680 of file graphnodeexpression.py.

def cma.graphnodeexpression.PAMMODARGS (   args,
  _context 
)
We pass the following arguments to PAMSELECTARGS:
    section - the section value to select from
    service - service type to search for
    module - the module to select arguments from
    argument - the arguments to select

We return the arguments from the first occurence of the module that we find.

Definition at line 785 of file graphnodeexpression.py.

def cma.graphnodeexpression.selectanipport (   arg,
  _context,
  preferlowestport = True,
  preferv4 = True 
)
This function searches discovery information for a suitable IP
address/port combination to go with the service.

Definition at line 1012 of file graphnodeexpression.py.

Referenced by cma.graphnodeexpression.serviceip(), cma.graphnodeexpression.serviceipport(), and cma.graphnodeexpression.serviceport().

Here is the caller graph for this function:

def cma.graphnodeexpression.serviceip (   args,
  context 
)
This function searches discovery information for a suitable concrete IP
address for a service.
The argument to this function tells it an expression that will give
it the hash table (map) of IP/port combinations for this service.

Definition at line 1037 of file graphnodeexpression.py.

References cma.graphnodeexpression.selectanipport().

Here is the call graph for this function:

def cma.graphnodeexpression.serviceipport (   args,
  context 
)
This function searches discovery information for a suitable ip:port combination.
The argument to this function tells it an expression that will give
it the hash table (map) of IP/port combinations for this service.
The return value is a legal ip:port combination for the given
address type (ipv4 or ipv6)

Definition at line 1081 of file graphnodeexpression.py.

References cma.graphnodeexpression.selectanipport().

Here is the call graph for this function:

def cma.graphnodeexpression.serviceport (   args,
  context 
)
This function searches discovery information for a suitable port for a service.
The argument to this function tells it an expression that will give
it the hash table (map) of IP/port combinations for this service.

Definition at line 1061 of file graphnodeexpression.py.

References cma.graphnodeexpression.selectanipport().

Here is the call graph for this function:

Variable Documentation

cma.graphnodeexpression.ipportregex = re.compile('(.*):([^:]*)$')

Definition at line 1011 of file graphnodeexpression.py.