@declared
def get_objects(ref):
 if (not isinstance(ref, basestring)):
  return ref
 name = ref
 if ('*' not in name):
  return get_object(name)
 hname = ''
 sdesc = ''
 if ('/' not in name):
  hname = name
 else:
  elts = name.split('/', 1)
  hname = elts[0]
  sdesc = elts[1]
 logger.debug('[trigger get_objects] Look for %s %s', hname, sdesc)
 res = []
 hosts = []
 services = []
 if ('*' not in hname):
  h = objs['hosts'].find_by_name(hname)
  if h:
   hosts.append(h)
 else:
  hname = hname.replace('*', '.*')
  p = re.compile(hname)
  for h in objs['hosts']:
   logger.debug('[trigger] Compare %s with %s', hname, h.get_name())
   if p.search(h.get_name()):
    hosts.append(h)
 if (not sdesc):
  return hosts
 for h in hosts:
  if ('*' not in sdesc):
   s = h.find_service_by_name(sdesc)
   if s:
    services.append(s)
  else:
   sdesc = sdesc.replace('*', '.*')
   p = re.compile(sdesc)
   for s in h.services:
    logger.debug('[trigger] Compare %s with %s', s.service_description, sdesc)
    if p.search(s.service_description):
     services.append(s)
 logger.debug('Found the following services: %s', services)
 return services

@ declared def get_objects ( ref ) : if ( not isinstance ( ref , basestring ) ) : return ref name = ref if ( '*' not in name ) : return get_object ( name ) hname = '' sdesc = '' if ( '/' not in name ) : hname = name else : elts = name . split ( '/' , 1 ) hname = elts [ 0 ] sdesc = elts [ 1 ] logger . debug ( '[trigger get_objects] Look for %s %s' , hname , sdesc ) res = [ ] hosts = [ ] services = [ ] if ( '*' not in hname ) : h = objs [ 'hosts' ] . find_by_name ( hname ) if h : hosts . append ( h ) else : hname = hname . replace ( '*' , '.*' ) p = re . compile ( hname ) for h in objs [ 'hosts' ] : logger . debug ( '[trigger] Compare %s with %s' , hname , h . get_name ( ) ) if p . search ( h . get_name ( ) ) : hosts . append ( h ) if ( not sdesc ) : return hosts for h in hosts : if ( '*' not in sdesc ) : s = h . find_service_by_name ( sdesc ) if s : services . append ( s ) else : sdesc = sdesc . replace ( '*' , '.*' ) p = re . compile ( sdesc ) for s in h . services : logger . debug ( '[trigger] Compare %s with %s' , s . service_description , sdesc ) if p . search ( s . service_description ) : services . append ( s ) logger . debug ( 'Found the following services: %s' , services ) return services
return a dict containing the necessary objects for deployment .