Database Reference
In-Depth Information
This function is called by other functions and
should never be called directly.
"""
if self.reloadtargs == True:
self.reloadtargs = False
self.fulltargs = \
emcli.list(resource='Targets').out()['data']
self.targprops = \
emcli.list(resource='TargetProperties'
).out()['data']
def props(self, propdict):
"""
props() can be called from an instance directly or
will be called by __init__() when defining the
instance or using the class directly. This function
defines a dictionary object of the property names
and values that will be applied to the defined
target list.
"""
assert isinstance(propdict, dict), \
'propdict parameter must be ' + \
'a dictionary of ' + \
'{"property_name":"property_value"}'
self.propdict = propdict
def filt(self, agentfilter='.*', typefilter='.*',
namefilter='.*',
sort=('TARGET_TYPE','TARGET_NAME'), show=False):
"""
filt() can be called from an instance directly or
will be called by __init__() when defining the
instance or using the class directly. This function
limits the target list by only including those targets
whose properties match the defined filters.
This function accepts the following parameters:
agentfilter - regular expression string applied
to the parent agent of the target
typefilter - regular expression string applied
to the target type value
namefilter - regular expression string applied
to the target name value
"""
self.targs = []
__agentcompfilt = re.compile(agentfilter)
__typecompfilt = re.compile(typefilter)
__namecompfilt = re.compile(namefilter)
self.__loadtargobjects()
for __inttarg in self.fulltargs:
if __typecompfilt.search(__inttarg['TARGET_TYPE']) \
and __namecompfilt.search(
__inttarg['TARGET_NAME']) \
Search WWH ::




Custom Search