From 3f7d712e13cb4a92a8baee3ec8678f6ae136002c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Fri, 12 Aug 2011 11:38:12 +0000 Subject: [PATCH] - Done is not a terminal state - Hnour the "terminal states" flag when matching notifications --- org.glite.lb.server/src/notif_match.c | 38 +++++++++++++++++++---------------- org.glite.lb.types/status.T | 1 - 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/org.glite.lb.server/src/notif_match.c b/org.glite.lb.server/src/notif_match.c index f27428c..b50c181 100644 --- a/org.glite.lb.server/src/notif_match.c +++ b/org.glite.lb.server/src/notif_match.c @@ -37,7 +37,7 @@ limitations under the License. #include "index.h" #include "authz_policy.h" -static int notif_match_conditions(edg_wll_Context,const edg_wll_JobStat *,const edg_wll_JobStat *,const char *); +static int notif_match_conditions(edg_wll_Context,const edg_wll_JobStat *,const edg_wll_JobStat *,const char *, int flags); int edg_wll_NotifExpired(edg_wll_Context,const char *); @@ -114,7 +114,7 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *oldstat, cons glite_common_log(LOG_CATEGORY_LB_SERVER, LOG_PRIORITY_DEBUG, "[%d] NOTIFY:%s expired at %s UTC", getpid(),jobc[0],asctime(gmtime(&expires))); } - else if (notif_match_conditions(ctx,oldstat,stat,jobc[4]) && + else if (notif_match_conditions(ctx,oldstat,stat,jobc[4],atoi(jobc[5])) && edg_wll_NotifCheckACL(ctx,stat,jobc[3], &authz_flags)) { char *dest; @@ -177,29 +177,33 @@ int edg_wll_NotifExpired(edg_wll_Context ctx,const char *notif) } -static int notif_match_conditions(edg_wll_Context ctx,const edg_wll_JobStat *oldstat, const edg_wll_JobStat *stat,const char *cond) +static int notif_match_conditions(edg_wll_Context ctx,const edg_wll_JobStat *oldstat, const edg_wll_JobStat *stat,const char *cond, int flags) { edg_wll_QueryRec **c,**p; - int match,i; + int match = 0,i; if (!cond) return 1; - if (parseJobQueryRec(ctx,cond,strlen(cond),&c)) { - glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_ERROR, - "notif_match_conditions(): parseJobQueryRec failed"); + if (!(flags & EDG_WLL_NOTIF_TERMINAL_STATES) || + ((flags & EDG_WLL_NOTIF_TERMINAL_STATES) && (EDG_WLL_JOB_TERMINAL_STATE[stat->state]))) { - return 1; - } + if (parseJobQueryRec(ctx,cond,strlen(cond),&c)) { + glite_common_log(LOG_CATEGORY_CONTROL, LOG_PRIORITY_ERROR, + "notif_match_conditions(): parseJobQueryRec failed"); - match = match_status(ctx,oldstat,stat,(const edg_wll_QueryRec **) c); - if ( c ) - { - for (p = c; *p; p++) { - for (i=0; (*p)[i].attr; i++) - edg_wll_QueryRecFree((*p)+i); - free(*p); + return 1; + } + + match = match_status(ctx,oldstat,stat,(const edg_wll_QueryRec **) c); + if ( c ) + { + for (p = c; *p; p++) { + for (i=0; (*p)[i].attr; i++) + edg_wll_QueryRecFree((*p)+i); + free(*p); + } + free(c); } - free(c); } return match; } diff --git a/org.glite.lb.types/status.T b/org.glite.lb.types/status.T index 0553dd1..bd1edea 100644 --- a/org.glite.lb.types/status.T +++ b/org.glite.lb.types/status.T @@ -191,7 +191,6 @@ _pad_ 20 @type Unknown Status cannot be determined. @type Purged Job has been purged from bookkeeping server (for LB-RGMA interface). -@terminal Done @terminal Aborted @terminal Cancelled @terminal Cleared -- 1.8.2.3