Skip to content

ENT-13847: Clarified section about variable injection#3647

Merged
olehermanse merged 1 commit into
cfengine:masterfrom
olehermanse:master
May 19, 2026
Merged

ENT-13847: Clarified section about variable injection#3647
olehermanse merged 1 commit into
cfengine:masterfrom
olehermanse:master

Conversation

@olehermanse
Copy link
Copy Markdown
Member

No description provided.

@olehermanse olehermanse changed the title ENT-13847: Clarified section about variable injection. ENT-13847: Clarified section about variable injection May 19, 2026
Ticket: ENT-13847
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
@olehermanse
Copy link
Copy Markdown
Member Author

@cf-bottom jenkins, please

@cf-bottom
Copy link
Copy Markdown

Alright, I triggered a build:

Build Status

Jenkins: https://ci.cfengine.com/job/fast-build-and-deploy-docs-master/29/

Documentation: http://buildcache.cfengine.com/packages/build-documentation-pr/jenkins-fast-build-and-deploy-docs-master-29/output/_site/

@olehermanse olehermanse merged commit 7f0a43d into cfengine:master May 19, 2026
2 checks passed
@olehermanse
Copy link
Copy Markdown
Member Author

Cherry-pick: #3648

As a general rule, variables cannot be defined or re-defined (overwritten) from outside their bundle.
There are 4 exceptions to this rule:

1. `meta` promises define variables in a different meta-suffixed bundle (this bundle is special / "virtual" and does not exist in the policy file).
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.

I dunno that you want to increase the complexity here, I don't know that it adds much but IIRC these _meta suffixed bundles are not precluded from being defined in policy

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.


#+begin_src cfengine3
  bundle agent main
  {
          methods:
         "one";
         "two";
   }
  bundle agent one
  {
        reports: "$(one_meta.tags)";
  }
  bundle agent one_meta
  {
        vars:
          "tags" slist => { "crazy", "stuff" };
  }
  bundle agent two
  {
        meta:
        "tags" slist => { "know", "what", "i'm", "sayin" };

        reports: "$(two_meta.tags)";
  }

#+end_src

#+RESULTS:
: R: crazy
: R: stuff
: R: know
: R: what
: R: i'm
: R: sayin

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