allow "all jobs" notifications
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 21 Oct 2004 10:38:29 +0000 (10:38 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 21 Oct 2004 10:38:29 +0000 (10:38 +0000)
org.glite.lb.server/Makefile
org.glite.lb.server/project/version.properties
org.glite.lb.server/src/notif_match.c
org.glite.lb.server/src/notification.c
org.glite.lb.server/src/query.h

index c54b1e6..b7ba4a9 100644 (file)
@@ -189,7 +189,7 @@ test_ws_plugin.o: ws_plugin.c
 doc:
 
 stage: compile
-       $(MAKE) install PREFIX=${stagedir}
+       $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes
 
 dist: distsrc distbin
 
@@ -218,6 +218,10 @@ install:
 
        ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-lb-bkserverd
 
+       if [ x${DOSTAGE} != xyes ]; then \
+               ${INSTALL} -m 755 ${stagedir}/bin/glite-lb-notif-interlogd ${PREFIX}/bin; \
+       fi
+
 clean:
 
 %.c: %.c.T
index 34f57ec..e794438 100644 (file)
@@ -1,4 +1,4 @@
 #Thu Oct 21 08:22:08 CEST 2004
-module.version=0.3.2
+module.version=0.4.0
 module.build=51
 module.age=1
index 10d97d4..7b23e73 100644 (file)
@@ -17,8 +17,6 @@
 #include "query.h"
 #include "il_notification.h"
 
-
-
 static int notif_match_conditions(edg_wll_Context,const edg_wll_JobStat *,const char *);
 static int notif_check_acl(edg_wll_Context,const edg_wll_JobStat *,const char *);
 
@@ -43,7 +41,8 @@ int edg_wll_NotifMatch(edg_wll_Context ctx, const edg_wll_JobStat *stat)
                "select distinct n.notifid,n.destination,n.valid,u.cert_subj,n.conditions "
                "from notif_jobs j,users u,notif_registrations n "
                "where j.notifid=n.notifid and n.userid=u.userid "
-               "   and j.jobid = '%|Ss'",ju = edg_wlc_JobIdGetUnique(stat->jobId));
+               "   and (j.jobid = '%|Ss' or j.jobid = '%|Ss')",
+               ju = edg_wlc_JobIdGetUnique(stat->jobId),NOTIF_ALL_JOBS);
 
        free(ju);
 
index 5c88757..42db973 100644 (file)
@@ -9,6 +9,7 @@
 #include "glite/lb/xml_parse.h"
 #include "glite/lb/notification.h"
 #include "lbs_db.h"
+#include "query.h"
 
 
 static char *get_user(edg_wll_Context ctx, int create);
@@ -107,7 +108,7 @@ int edg_wll_NotifNewServer(
        if ( edg_wll_ExecStmt(ctx, q, NULL) < 0 )
                goto cleanup;
 
-       for ( i = 0; jobs[i]; i++ )
+       if (jobs) for ( i = 0; jobs[i]; i++ )
        {
                free(q);
                trio_asprintf(&q,
@@ -127,6 +128,12 @@ int edg_wll_NotifNewServer(
                        goto cleanup;
                }
        }
+       else {
+               trio_asprintf(&q,"insert into notif_jobs(notifid,jobid) values ('%|Ss','%|Ss')",
+                               nid_s,NOTIF_ALL_JOBS);
+               if ( edg_wll_ExecStmt(ctx, q, NULL) < 0 ) goto cleanup;
+
+       }
 
 
 cleanup:
@@ -496,10 +503,10 @@ static int split_cond_list(
        int                                     i, j, jobs_ct, nconds_ct;
 
 
-       if ( !conditions || !conditions[0] )
-               return edg_wll_SetError(ctx, EINVAL, "Empty condition list");
-
-       for ( nconds_ct = jobs_ct = i = 0; conditions[i]; i++ )
+       if ( !conditions || !conditions[0] ) {
+               if (ctx->noAuth) nconds_ct = jobs_ct = 0;
+               else return edg_wll_SetError(ctx, EINVAL, "Empty condition list");
+       } else for ( nconds_ct = jobs_ct = i = 0; conditions[i]; i++ )
        {
                if ( conditions[i][0].attr && conditions[i][0].attr != EDG_WLL_QUERY_ATTR_JOBID )
                        nconds_ct++;
index fb421e4..fe9c9e8 100644 (file)
@@ -1,3 +1,5 @@
 int convert_event_head(edg_wll_Context,char **,edg_wll_Event *);
 int check_strict_jobid(edg_wll_Context, const edg_wlc_JobId);
 int match_status(edg_wll_Context, const edg_wll_JobStat *stat,const edg_wll_QueryRec **conditions);
+
+#define NOTIF_ALL_JOBS "all_jobs"