During tests it is common to add/delete test eventscripts at runtime.
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 21 Oct 2009 05:50:39 +0000 (16:50 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 21 Oct 2009 05:50:39 +0000 (16:50 +1100)
This can race with teh eventascript handling that does a :

list all scripts,   sort them,  then execute them

so trap status code 127 which means the script could not be executed (or /bin/sh does not exist) and treat it as not to cause the node to become unhealthy

server/eventscript.c

index e84f1308ec7053b58a5f6b4c78ade5f4640814a9..8a62af9c5422c3451d71fc06d7e5fe4aabc55a11 100644 (file)
@@ -593,6 +593,11 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
                if (ret != -1) {
                        ret = WEXITSTATUS(ret);
                }
+               if (ret == 127) {
+                       ret = 0;
+                       DEBUG(DEBUG_ERR,("Script %s returned status 127. Someone just deleted it?\n", cmdstr));
+               }
                if (is_monitor == 1) {
                        if (ctdb_ctrl_event_script_stop(ctdb, ret) != 0) {
                                DEBUG(DEBUG_ERR,(__location__ " Failed to stop event script monitoring\n"));