Logo Search packages:      
Sourcecode: condor version File versions  Download package

bool DaemonCore::evalExpr ( ClassAd ad,
const char *  param_name,
const char *  attr_name,
const char *  message 
) [private]

Evaluate a DC-specific policy expression and return the result. Prints a message to the log if the expr evaluates to TRUE.

Parameters:
ad ClassAd to evaluate the expression in.
param_name Name of the config file parameter that defines the expression.
attr_name Name of the ClassAd attribute for this expression.
message Additional text to include in the log message when the expression evaluates to TRUE.
Returns:
true if the expression exists and evaluates to TRUE, false otherwise.

Definition at line 9533 of file daemon_core.cpp.

Referenced by sendUpdates().

{
      bool value = false;
      char* expr = param(param_name);
      if (!expr) {
            expr = param(attr_name);
      }
      if (expr) {
            if (!ad->AssignExpr(attr_name, expr)) {
                  dprintf( D_ALWAYS|D_FAILURE,
                               "ERROR: Failed to parse %s expression \"%s\"\n",
                               attr_name, expr );
                  free(expr);
                  return false;
            }
            int result = 0;
            if (ad->EvalBool(attr_name, NULL, result) && result) {
                  dprintf( D_ALWAYS,
                               "The %s expression \"%s\" evaluated to TRUE: %s\n",
                               attr_name, expr, message );
                  value = true;
            }
            free(expr);
      }
      return value;
}


Generated by  Doxygen 1.6.0   Back to index