Skip to content

Made cf-reactor keep all agent promises - #6426

Merged
larsewi merged 2 commits into
cfengine:masterfrom
victormlg:cf-reactor.EvalAllAgentPromiseTypes
Oct 28, 2026
Merged

larsewi merged 2 commits into
cfengine:masterfrom
victormlg:cf-reactor.EvalAllAgentPromiseTypes

Conversation

@victormlg

@victormlg victormlg commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

We can now do:

bundle reactor create_file(file)
{
  files:
    "$(file)"
       create => "true";
}

bundle reactor setup_event
{
  vars:
    "inp" string => "/tmp/a";

   events:
     "my event"
       when => deleted("$(inp)"),
       then => create_file("$(inp)");
}

@cf-bottom

Copy link
Copy Markdown

Thank you for submitting a pull request! Maybe @craigcomstock can review this?

@victormlg
victormlg force-pushed the cf-reactor.EvalAllAgentPromiseTypes branch from 49067c5 to e09569a Compare October 27, 2026 10:26
Comment thread libpromises/policy.c
success &= PolicyCheckBundleSections(bundle->sections, errors);
success &= PolicyCheckBundleSections(bundle->custom_sections, errors);

if (StringEqual(bundle->type, CF_REACTORC))

@larsewi larsewi left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It feels a bit wrong to have the reactor bundle do anything the agent can do. They should be two different things in my opinion. The reactor bundles should only be used to register events. And the agent bundles should do changes to the system.

Does this mean every time we load the policy, reactor will do changes to the system? While its job should be to register watchers?

Maybe I'm misunderstanding this?

Comment thread tests/reactor/tests/02_then_bundles/017_agent_bundle.cf Outdated
@victormlg
victormlg requested a review from olehermanse October 27, 2026 14:27
Previously cf-reactor only evaluates meta, vars, classes and events promise types.
Now, it can run any of the ones avalaible in agent bundles, in addition to events.

Event promises and promises found in agent bundles are mutually exclusive inside reactor
bundles. When cf-reactor reads the policy to create the watchers, it only does so with
bundles that have an events promise

Signed-off-by: Victor Moene <victor.moene@northern.tech>
Instead of running agent bundles inside "then" attribute, we can run reactor
bundles

Signed-off-by: Victor Moene <victor.moene@northern.tech>
@victormlg
victormlg force-pushed the cf-reactor.EvalAllAgentPromiseTypes branch from 614f292 to ad36a1f Compare October 27, 2026 15:57
@victormlg

Copy link
Copy Markdown
Contributor Author

@cf-bottom jenkins, please :)

@cf-bottom

Copy link
Copy Markdown

@larsewi
larsewi merged commit ddbb2be into cfengine:master Oct 28, 2026
43 of 45 checks passed
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.

4 participants