Skip to content

ENT-14197: Accept list of bundles in "then" attribute in event promises - #6384

Open
victormlg wants to merge 1 commit into
cfengine:masterfrom
victormlg:cf-reactor.AcceptBundleList
Open

victormlg wants to merge 1 commit into
cfengine:masterfrom
victormlg:cf-reactor.AcceptBundleList

Conversation

@victormlg

Copy link
Copy Markdown
Contributor
bundle reactor event_handler
{
  vars:
    "A" string => "/tmp/a";
    "B" string => "/tmp/b";
    "C" string => "/tmp/c";

  events:
    "Create $(A)"
      when => file_deleted("$(A)"),
      then => create_file("$(A)");
    "Create $(B)"
      when => file_deleted("$(B)"),
      then => { create_file("$(B)") };
    "Create $(C)"
      when => file_deleted("$(C)"),
      then => { print("hello world"), create_file("$(C)"), "do_something" };
}

The "then" attribute in events promises accepts both simple bundles
and list of bundles, similar to bundlsequences.

Ticket: ENT-14197
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Comment thread libpromises/promises.c
}

if (ExpectedDataType(cp->lval) == CF_DATA_TYPE_BUNDLE)
const DataType expected_type = ExpectedDataType(cp->lval);
Comment thread libpromises/promises.c
}
else if (expected_type == CF_DATA_TYPE_BUNDLE_LIST)
{
*rval_out = ExpandBundleListReference(ctx, NULL, "this", cp->rval);
Comment thread libpromises/syntax.c
JsonObjectAppendString(json_constraint, "type", DataTypeToString(constraint_syntax->dtype));

if (constraint_syntax->dtype != CF_DATA_TYPE_BODY && constraint_syntax->dtype != CF_DATA_TYPE_BUNDLE)
if (constraint_syntax->dtype != CF_DATA_TYPE_BODY
Comment thread libpromises/syntax.c

if (constraint_syntax->dtype != CF_DATA_TYPE_BODY && constraint_syntax->dtype != CF_DATA_TYPE_BUNDLE)
if (constraint_syntax->dtype != CF_DATA_TYPE_BODY
&& constraint_syntax->dtype != CF_DATA_TYPE_BUNDLE
Comment thread libpromises/syntax.c
if (constraint_syntax->dtype != CF_DATA_TYPE_BODY && constraint_syntax->dtype != CF_DATA_TYPE_BUNDLE)
if (constraint_syntax->dtype != CF_DATA_TYPE_BODY
&& constraint_syntax->dtype != CF_DATA_TYPE_BUNDLE
&& constraint_syntax->dtype != CF_DATA_TYPE_BUNDLE_LIST)
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