Skip to content

ENT-14463: Made cf-reactor evaluate the reactor bundles - #6361

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

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

Conversation

@victormlg

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
cf-reactor can now read agent and reactor bundles, and updates them periodically

ticket: ENT-14463
Signed-off-by: Victor Moene <victor.moene@northern.tech>
cf-reactor can now read policy from a specific input file

Signed-off-by: Victor Moene <victor.moene@northern.tech>
Currently, we only support a single file to be watched

Signed-off-by: Victor Moene <victor.moene@northern.tech>
cf-reactor can now evaluate reactor bundles (vars, classes) and the new events promise type.

Signed-off-by: Victor Moene <victor.moene@northern.tech>
Comment thread cf-reactor/cf-reactor.c
time_t validated_at = ReadTimestampFromPolicyValidatedFile(config, NULL);

bool reload_policy = false;
if (config->agent_specific.daemon.last_validated_at < validated_at)
Comment thread cf-reactor/cf-reactor.c
}

ClearRequestReloadConfig();
config->agent_specific.daemon.last_validated_at = validated_at;
Comment thread cf-reactor/cf-reactor.c
return;
}

Log(LOG_LEVEL_NOTICE, "Rereading policy file '%s'", config->input_file);
// TODO: adapt this function to the original design
static void KeepEventsPromise(EvalContext *ctx, const Promise *pp)
{
const char *key = pp->promiser;
if (!sp || SeqLength(sp->promises) == 0)
{
Log(LOG_LEVEL_DEBUG, "No promise type %s in bundle %s",
REACTOR_TYPESEQUENCE[i], bp->name);

void KeepReactorPromises(EvalContext *ctx, const Policy *policy)
{
for (size_t i = 0; i < SeqLength(policy->bundles); i++)
{
for (size_t i = 0; i < SeqLength(policy->bundles); i++)
{
Bundle *bp = SeqAt(policy->bundles, i);
if (config->agent_type == AGENT_TYPE_SERVER ||
config->agent_type == AGENT_TYPE_MONITOR ||
config->agent_type == AGENT_TYPE_EXECUTOR)
config->agent_type == AGENT_TYPE_EXECUTOR ||
config->agent_type == AGENT_TYPE_MONITOR ||
config->agent_type == AGENT_TYPE_EXECUTOR)
config->agent_type == AGENT_TYPE_EXECUTOR ||
config->agent_type == AGENT_TYPE_REACTOR)
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