Exemple #1
0
  def __getPolTypes(self, **kwargs):
    """Get Policy Types from config that match the given keyword
    arguments"""
    pTconfig = getTypedDict("PolicyTypes")

    pTypes = []

    for pt in pTconfig:
      if dictMatch(kwargs, pTconfig[pt]):
        pTypes.append(pt)

    for pt_name in pTypes:
      if 'Alarm_PolType' in pt_name:
        pTypes.remove(pt_name)
        pTypes.append('Alarm_PolType')

    return pTypes
Exemple #2
0
  def __getPolToEval(self, useNewRes = False, **kwargs):

    pConfig = getTypedDict("Policies")
    pol_to_eval = []

    for p in pConfig:
      if dictMatch(kwargs, pConfig[p]):
        pol_to_eval.append(p)

    polToEval_Args = []

    for p in pol_to_eval:
      try:
        moduleName = self.C_Policies[p]['module']
      except KeyError:
        moduleName = None
      try:
        ConfirmationPolicy = self.C_Policies[p]['ConfirmationPolicy']
      except KeyError:
        ConfirmationPolicy = None
#      args = self.C_Policies[p]['args']
      if useNewRes:
        try:
          commandIn = self.C_Policies[p]['commandInNewRes']
        except:
          commandIn = self.C_Policies[p]['commandIn']
      else:
        commandIn = self.C_Policies[p]['commandIn']

      if useNewRes:
        try:
          args = self.C_Policies[p]['argsNewRes']
        except:
          args = self.C_Policies[p]['args']
      else:
        args = self.C_Policies[p]['args']

      polToEval_Args.append({'Name' : p, 'Module' : moduleName, 'args' : args,
                             'ConfirmationPolicy' : ConfirmationPolicy,
                             'commandIn' : commandIn})

    return polToEval_Args