Skip to content

ENT-14194: Run policy on event - #6362

Draft
victormlg wants to merge 2 commits into
cfengine:masterfrom
victormlg:ENT-14463-part-3
Draft

victormlg wants to merge 2 commits into
cfengine:masterfrom
victormlg:ENT-14463-part-3

Conversation

@victormlg

Copy link
Copy Markdown
Contributor

No description provided.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@victormlg victormlg changed the title ENT-14463: Run policy on event ENT-14194: Run policy on event Sep 24, 2026
@victormlg
victormlg force-pushed the ENT-14463-part-3 branch 2 times, most recently from b7d8916 to 33ee80a Compare September 29, 2026 11:26
VarRefDestroy(ref);
}

static PromiseResult KeepAgentPromise(EvalContext *ctx, const Promise *pp, ARG_UNUSED void *param)
DataType value_type = CF_DATA_TYPE_NONE;
const void *value = NULL;
{
VarRef *ref = VarRefParseFromScope(pp->promiser, "this");
}

{
VarRef *ref = VarRefParseFromBundle(pp->promiser, PromiseGetBundle(pp));

static void LogVariableValue(const EvalContext *ctx, const Promise *pp)
{
VarRef *ref = VarRefParseFromBundle(pp->promiser, PromiseGetBundle(pp));
/* TODO is CF_DATA_TYPE_NONE acceptable? Today all meta variables
* are of this type. */
/* UnexpectedError("Variable '%s' is of unknown type %d", */
/* pp->promiser, type); */
{
Log(LOG_LEVEL_VERBOSE, "A: Promises kept in '%s' = %.0lf", bundle->name, delta_pr_kept);
Log(LOG_LEVEL_VERBOSE, "A: Promises not kept in '%s' = %.0lf", bundle->name, delta_pr_notkept);
Log(LOG_LEVEL_VERBOSE, "A: Promises repaired in '%s' = %.0lf", bundle->name, delta_pr_repaired);
bundle_compliance = (delta_pr_kept + delta_pr_repaired) / (delta_pr_kept + delta_pr_notkept + delta_pr_repaired);

Log(LOG_LEVEL_VERBOSE, "A: Aggregate compliance (promises kept/repaired) for bundle '%s' = %.1lf%%",
bundle->name, bundle_compliance * 100.0);
if (LogGetGlobalLevel() >= LOG_LEVEL_INFO)
{
char name[CF_MAXVARSIZE];
snprintf(name, CF_MAXVARSIZE, "%s:%s", bundle->ns, bundle->name);
if (LogGetGlobalLevel() >= LOG_LEVEL_INFO)
{
char name[CF_MAXVARSIZE];
snprintf(name, CF_MAXVARSIZE, "%s:%s", bundle->ns, bundle->name);

void EvalContextPromiseLockCacheClear(EvalContext *ctx)
{
StringSetClear(ctx->promise_lock_cache);
{
cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, a,
"Reactor events promise '%s' refers to unknown bundle '%s'",
pp->promiser, (name != NULL) ? name : "(invalid)");
if (then_constraint == NULL)
{
cfPS(ctx, LOG_LEVEL_ERR, PROMISE_RESULT_FAIL, pp, a,
"Reactor events promise '%s' does not specify a 'then' bundle", pp->promiser);
static char *EventsPromiseKey(const Promise *pp)
{
const Bundle *bp = PromiseGetBundle(pp);
return StringFormat("%s:%s:%s", bp->ns, bp->name, pp->promiser);
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants