static void VerifyProcesses(EvalContext *ctx, Attributes a, Promise *pp) { CfLock thislock; char lockname[CF_BUFSIZE]; if (a.restart_class) { snprintf(lockname, CF_BUFSIZE - 1, "proc-%s-%s", pp->promiser, a.restart_class); } else { snprintf(lockname, CF_BUFSIZE - 1, "proc-%s-norestart", pp->promiser); } thislock = AcquireLock(ctx, lockname, VUQNAME, CFSTARTTIME, a.transaction, pp, false); if (thislock.lock == NULL) { return; } ScopeDeleteSpecialScalar("this", "promiser"); ScopeNewSpecialScalar(ctx, "this", "promiser", pp->promiser, DATA_TYPE_STRING); PromiseBanner(pp); VerifyProcessOp(ctx, PROCESSTABLE, a, pp); ScopeDeleteSpecialScalar("this", "promiser"); YieldCurrentLock(thislock); }
void VerifyMethodsPromise(EvalContext *ctx, Promise *pp) { Attributes a = { {0} }; a = GetMethodAttributes(ctx, pp); VerifyMethod(ctx, "usebundle", a, pp); ScopeDeleteSpecialScalar("this", "promiser"); }
void ScopeNewSpecialScalar(EvalContext *ctx, const char *scope, const char *lval, const char *rval, DataType dt) { assert(ScopeIsReserved(scope)); Rval rvald; if (EvalContextVariableGet(ctx, (VarRef) { NULL, scope, lval }, &rvald, NULL)) { ScopeDeleteSpecialScalar(scope, lval); } EvalContextVariablePut(ctx, (VarRef) { NULL, scope, lval }, (Rval) {(char *) rval, RVAL_TYPE_SCALAR }, dt); }
void ScopeDeleteScalar(VarRef lval) { assert(!ScopeIsReserved(lval.scope)); if (ScopeIsReserved(lval.scope)) { ScopeDeleteSpecialScalar(lval.scope, lval.lval); } Scope *scope = ScopeGet(lval.scope); if (scope == NULL) { return; } if (HashDeleteElement(scope->hashtable, lval.lval) == false) { CfDebug("Attempt to delete non-existent variable %s in scope %s\n", lval.lval, lval.scope); } }