Skip to content

ENT-14192: Update parser with event driven cfengine syntax#6202

Open
victormlg wants to merge 1 commit into
cfengine:masterfrom
victormlg:cf-watchd-parser
Open

ENT-14192: Update parser with event driven cfengine syntax#6202
victormlg wants to merge 1 commit into
cfengine:masterfrom
victormlg:cf-watchd-parser

Conversation

@victormlg

@victormlg victormlg commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Depends on: #6186

This PR simply allows the new event promise type to be parsed, but is ignored by cf-agent. Test policy:


bundle agent main {
  reports:
    "Hello world";
}

body when file_deleted(filename)
{
  files_deleted => { "$(filename)" };
}

bundle agent create_file(filename)
{
  files:
    "$(filename)" create => "true";
}


bundle reactor event_handler {

  events:
    "Create /tmp/a"
      when => file_deleted("/tmp/a"),
      then => create_file("/tmp/a");

    "Create /tmp/b"
      when => file_deleted("/tmp/b"),
      then => create_file("/tmp/b");
}

The syntax here differs from the one defined in the ticket: event promises only take one single when body and one single then bundle. There is a ticket for this in the future.

@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.

LGTM 🚀

Comment thread libpromises/mod_watch.c Outdated
Comment thread libpromises/mod_watch.h Outdated
@larsewi

larsewi commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Add a test please :)

@olehermanse olehermanse changed the title ENT-14192: Update parser with agent driven cfengine syntax ENT-14192: Update parser with event driven cfengine syntax Jul 1, 2026

@olehermanse olehermanse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix copyright year, add a minimal syntax test, and wait for release.

Ticket: ENT-14192
Changelog: Title
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

Development

Successfully merging this pull request may close these issues.

3 participants