Пример #1
0
PromiseResult VerifyMethodsPromise(EvalContext *ctx, const Promise *pp)
{
    Attributes a = GetMethodAttributes(ctx, pp);

    const Constraint *cp;
    Rval method_name;

    if ((cp = PromiseGetConstraint(pp, "usebundle")))
    {
        method_name = cp->rval;
    }
    else
    {
        method_name = DefaultBundleConstraint(pp, "method");
    }

    PromiseResult result = VerifyMethod(ctx, method_name, a, pp);

    return result;
}
Пример #2
0
static FnCall *DefaultServiceBundleCall(const Promise *pp, const char *service_policy)
{
    Rlist *args = NULL;
    FnCall *call = NULL;

    RlistAppend(&args, pp->promiser, RVAL_TYPE_SCALAR);
    RlistAppend(&args, service_policy, RVAL_TYPE_SCALAR);

    Rval name = DefaultBundleConstraint(pp, "service");

    if (PolicyGetBundle(PolicyFromPromise(pp), PromiseGetBundle(pp)->ns, "agent", (char *)name.item))
    {
        Log(LOG_LEVEL_VERBOSE, "Found service special bundle %s in ns %s\n", (char *)name.item, PromiseGetBundle(pp)->ns);
        call = FnCallNew(name.item, args);
    }
    else
    {
        call = FnCallNew("standard_services", args);
    }

    return call;
}