various improvements
- use dig for resolving host names - ascon.c: fix terminator parsing - property callback: change property before callback - logger.c:default for logger period must be the old value instead of 1 - add frappy type history writing - increase max. logreader line length - HIPNONE returns "null" with json protocol - encode strings properly in formatNameValue - fix memory leak in json2tcl - scriptcontext: do not show debug messages when script starts with underscore or when the "send" property is empty - scriptcontext: remove args for action timestamp - scriptcontext: "que" function will replace an already queued action, e.g. for 'halt - introduced updatestatus script
This commit is contained in:
@ -79,7 +79,7 @@ static int SCTDRIVHalt(void *data)
|
||||
self = (pSICSOBJ) data;
|
||||
pPriv = (pDrivObjPriv) self->pPrivate;
|
||||
if (GetHdbProperty(self->objectNode, "halt", dummy, sizeof dummy)) {
|
||||
SctQueueNode(pPriv->c, self->objectNode, HaltPRIO, "halt",
|
||||
SctQueueNode(pPriv->c, self->objectNode, HaltPRIO, "halt", 1,
|
||||
pPriv->pCon);
|
||||
} else
|
||||
if (GetHdbProperty(self->objectNode, "status", dummy, sizeof dummy))
|
||||
@ -177,7 +177,8 @@ static int SCTDRIVCheckStatus(void *data, SConnection * pCon)
|
||||
Tcl_Interp *pTcl = NULL;
|
||||
char *result;
|
||||
SConnection *con;
|
||||
|
||||
int ret;
|
||||
|
||||
self = (pSICSOBJ) data;
|
||||
pPriv = (pDrivObjPriv) self->pPrivate;
|
||||
|
||||
@ -186,7 +187,8 @@ static int SCTDRIVCheckStatus(void *data, SConnection * pCon)
|
||||
*/
|
||||
if (GetHdbProperty(self->objectNode, "writestatus", script, 1024)) {
|
||||
if (strcmp(script, "start") == 0) {
|
||||
return HWBusy;
|
||||
ret = HWBusy;
|
||||
goto Return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +200,9 @@ static int SCTDRIVCheckStatus(void *data, SConnection * pCon)
|
||||
SCWrite(pCon,
|
||||
"ERROR: configuration problem: no checkstatus script!",
|
||||
eError);
|
||||
return HWFault;
|
||||
ret = HWFault;
|
||||
result = "error";
|
||||
goto Return;
|
||||
}
|
||||
result = script;
|
||||
} else {
|
||||
@ -206,7 +210,9 @@ static int SCTDRIVCheckStatus(void *data, SConnection * pCon)
|
||||
pPriv->c, &result);
|
||||
if (status == 0) {
|
||||
SCPrintf(pCon, eError, " script %s returned %s", script, result);
|
||||
return HWFault;
|
||||
ret = HWFault;
|
||||
result = "error";
|
||||
goto Return;
|
||||
}
|
||||
if (SctDebugConn(pPriv->c)) {
|
||||
SCPf(SCPureSockWrite, SctDebugConn(pPriv->c), eError,
|
||||
@ -214,20 +220,28 @@ static int SCTDRIVCheckStatus(void *data, SConnection * pCon)
|
||||
}
|
||||
}
|
||||
if (strstr(result, "run") != NULL) {
|
||||
return HWBusy;
|
||||
ret = HWBusy;
|
||||
} else if (strstr(result, "posfault") != NULL) {
|
||||
return HWPosFault;
|
||||
ret = HWPosFault;
|
||||
} else if (strstr(result, "error") != NULL) {
|
||||
return HWFault;
|
||||
ret = HWFault;
|
||||
} else if (strstr(result, "idle") != NULL) {
|
||||
return HWIdle;
|
||||
ret = HWIdle;
|
||||
} else {
|
||||
SCPrintf(pCon, eError,
|
||||
"ERROR: invalid status code %s returned from checkstatus script",
|
||||
result);
|
||||
return HWFault;
|
||||
ret = HWFault;
|
||||
}
|
||||
return HWFault;
|
||||
Return:
|
||||
if (GetHdbProperty(self->objectNode, "updatestatus", script, 1024)) {
|
||||
status = SctCallInContext(pCon, script, self->objectNode,
|
||||
pPriv->c, &result);
|
||||
if (status == 0) {
|
||||
SCPrintf(pCon, eError, " %s returned %s", script, result);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user