- New flag, specific for anonymization branch_3_0_job_summaries
authorZdeněk Šustr <sustr4@cesnet.cz>
Mon, 23 Jan 2012 15:51:10 +0000 (15:51 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Mon, 23 Jan 2012 15:51:10 +0000 (15:51 +0000)
- Avoid empty lines in the keeper script
- Initial versions of the default config and cron file

org.glite.lb.client/src/notify.c
org.glite.lb.common/interface/jobstat.h.T
org.glite.lb.common/src/xml_conversions.c
org.glite.lb.server/config/site-notif.conf [new file with mode: 0644]
org.glite.lb.server/glite-lb-notif-keeper.cron [new file with mode: 0644]
org.glite.lb.server/src/lb_authz.c
org.glite.lb.server/src/notif-keeper.sh

index 9b89148..efd740e 100644 (file)
@@ -63,6 +63,7 @@ static void usage(char *cmd)
                        "    -B | --bootstrap   Also send past events matching conditions\n"
                        "    -T | --terminal    Notify only when a job reaches terminal state\n"
                        "    -H | --history     Same as -T plus attach a history of all job's Events\n"
+                       "    -N | --aNonymize   Anonymize all owner data in all messages under this registration\n"
                        , me);
        if ( !cmd || !strcmp(cmd, "bind") )
                fprintf(stderr,"\n'bind' command usage: %s bind [ { -s socket_fd | -a fake_addr } -t requested_validity ] notifids \n"
@@ -140,6 +141,7 @@ int main(int argc,char **argv)
                        {"bootstrap", no_argument, 0, 'B'},
                        {"terminal", no_argument, 0, 'T'},
                        {"history", no_argument, 0, 'H'},
+                       {"anonymize", no_argument, 0, 'N'},
                        {0, 0, 0, 0}};
                int option_index = 0;
                char *single, *statelist, *notif_server;
@@ -151,7 +153,7 @@ int main(int argc,char **argv)
                conditions = (edg_wll_QueryRec **)calloc(MAX_NEW_CONDS + 1,sizeof(edg_wll_QueryRec *));
                conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
 
-               while ((c = getopt_long(argc-1,argv+1,"j:o:v:n:s:a:t:f:cOS:JBTH",long_options,&option_index)) > 0) { switch (c) {
+               while ((c = getopt_long(argc-1,argv+1,"j:o:v:n:s:a:t:f:cOS:JBTHN",long_options,&option_index)) > 0) { switch (c) {
                        case 'j':
                                conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
                                conditions[i][0].attr = EDG_WLL_QUERY_ATTR_JOBID;
@@ -212,6 +214,8 @@ int main(int argc,char **argv)
                                flags |= EDG_WLL_NOTIF_TERMINAL_STATES; break;
                        case 'H':
                                flags |= EDG_WLL_NOTIF_TERMINAL_STATES | EDG_WLL_NOTIF_HISTORY; break;
+                       case 'N':
+                               flags |= EDG_WLL_NOTIF_ANONYMIZE; break;
                        case 'c':
                                conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec));
                                conditions[i][0].attr = EDG_WLL_QUERY_ATTR_STATUS;
index 278cd86..9a98e26 100644 (file)
@@ -172,6 +172,7 @@ typedef struct _edg_wll_JobStat {
 #define EDG_WLL_STAT_CHILDSTAT 4       /**< apply the flags recursively to subjobs */
 #define EDG_WLL_STAT_CHILDHIST_FAST 8          /**< partially complete histogram of child job states */
 #define EDG_WLL_STAT_CHILDHIST_THOROUGH 16     /**< full and up-to date histogram of child job states */
+#define EDG_WLL_NOTIF_ANONYMIZE        32      /**< Always return user identity anonymized */
 #define EDG_WLL_NOTIF_TERMINAL_STATES 64       /**< Generate notifications on terminal states */
 #define EDG_WLL_NOTIF_HISTORY 128      /**< Attach all job's events to the notification */
 #define EDG_WLL_NOTIF_BOOTSTRAP 256    /**< send the state of the all already existing jobs too */
index f3df3a3..0c022cb 100644 (file)
@@ -773,6 +773,7 @@ char *edg_wll_stat_flags_to_string(int flags)
         if (flags & EDG_WLL_STAT_NO_STATES)      append_flag(&cflags, "no_states");
         if (flags & EDG_WLL_STAT_CHILDHIST_FAST) append_flag(&cflags, "childhist_fast");
         if (flags & EDG_WLL_STAT_CHILDHIST_THOROUGH) append_flag(&cflags, "childhist_thorough");
+        if (flags & EDG_WLL_NOTIF_ANONYMIZE) append_flag(&cflags, "anonymized");
         if (flags & EDG_WLL_NOTIF_TERMINAL_STATES)     append_flag(&cflags, "terminal_states");
         if (flags & EDG_WLL_NOTIF_HISTORY)       append_flag(&cflags, "history");
         if (flags & EDG_WLL_NOTIF_BOOTSTRAP)     append_flag(&cflags, "bootstrap");
@@ -799,6 +800,7 @@ int edg_wll_string_to_stat_flags(char *cflags)
                if (!strcmp(sflag,"no_states")) flags = flags | EDG_WLL_STAT_NO_STATES;
                 if (!strcmp(sflag,"childhist_fast")) flags = flags | EDG_WLL_STAT_CHILDHIST_FAST;
                 if (!strcmp(sflag,"childhist_thorough")) flags = flags | EDG_WLL_STAT_CHILDHIST_THOROUGH;
+                if (!strcmp(sflag,"anonymized")) flags = flags | EDG_WLL_NOTIF_ANONYMIZE;
                if (!strcmp(sflag,"terminal_states")) flags = flags | EDG_WLL_NOTIF_TERMINAL_STATES;
                if (!strcmp(sflag,"history")) flags = flags | EDG_WLL_NOTIF_HISTORY;
                if (!strcmp(sflag,"bootstrap")) flags = flags | EDG_WLL_NOTIF_BOOTSTRAP;
diff --git a/org.glite.lb.server/config/site-notif.conf b/org.glite.lb.server/config/site-notif.conf
new file mode 100644 (file)
index 0000000..17c8352
--- /dev/null
@@ -0,0 +1,5 @@
+#Site-wide notification registration. This file is read by glite-lb-notif-keeper.sh, initiated by cron
+
+#Uncomment the following line if you wish to submit anonymous data to the Grid Observatory experiment
+#go    --history --anonymize -a x-msg://grid.emi.gridobservatory
+
diff --git a/org.glite.lb.server/glite-lb-notif-keeper.cron b/org.glite.lb.server/glite-lb-notif-keeper.cron
new file mode 100644 (file)
index 0000000..ae0cd74
--- /dev/null
@@ -0,0 +1 @@
+0 */4 * * *    glite   ( test -f /etc/profile.d/grid-env.sh || exit 0; . /etc/profile.d/grid-env.sh; printf "`date "+\%b \%e \%T"` `hostname -s` glite-lb-notif-keeper: "; @glite_prefix@/sbin/glite-lb-notif-keeper )
index 6cc9981..ca4bf99 100644 (file)
@@ -1189,7 +1189,7 @@ check_jobstat_authz(edg_wll_Context ctx,
     if (stat->payload_owner && edg_wll_gss_equal_subj(peer->name, stat->payload_owner))
        return 1;
 
-    if (job_flags & EDG_WLL_NOTIF_HISTORY ||
+    if (job_flags & EDG_WLL_NOTIF_ANONYMIZE ||
        check_authz_policy(&ctx->authz_policy, peer, READ_ANONYMIZED))
        *authz_flags |= READ_ANONYMIZED;
 
index b80144f..ed51cb8 100644 (file)
@@ -29,10 +29,12 @@ while read line ; do
        cleanline=`echo $line | sed -r 's/^\s*//'`
        echo "$line" | grep -E "^#" > /dev/null
        if [ $? -ne 0 ]; then
-               HANDLES[$TOTALNOTIFS]=`echo $cleanline | sed -r 's/\s+.*$//'`
-               OPTIONS[$TOTALNOTIFS]=`echo $cleanline | sed -r 's/^\w+\s+//'`
-               TOPICS[$TOTALNOTIFS]=`echo ${OPTIONS[${TOTALNOTIFS}]} | grep -E -o '\-a[ ]+x-msg://[^ ]+' | sed -r 's/^.*msg:\/\///'`
-               TOTALNOTIFS=$(($TOTALNOTIFS+1))
+               if [ "$cleanline" != "" ]; then
+                       HANDLES[$TOTALNOTIFS]=`echo $cleanline | sed -r 's/\s+.*$//'`
+                       OPTIONS[$TOTALNOTIFS]=`echo $cleanline | sed -r 's/^\w+\s+//'`
+                       TOPICS[$TOTALNOTIFS]=`echo ${OPTIONS[${TOTALNOTIFS}]} | grep -E -o '\-a[ ]+x-msg://[^ ]+' | sed -r 's/^.*msg:\/\///'`
+                       TOTALNOTIFS=$(($TOTALNOTIFS+1))
+               fi
        fi
 done < $infile