How can I prevent a variable from being defined when the bundle is not explicitly actuated (part of bundlesequence or called via methods)?
bundle agent foo {
vars:
"test_thing" string => "I am here";
}
bundle agent main {
classes:
"something_exists"
expression => fileexists( "/tmpx" );
# I can change the above from /tmp to /tmpx and test_thing is always defined
methods:
something_exists::
"foo";
reports:
something_exists::
"something_exists is defined";
!something_exists::
"something_exists is NOT defined";
any::
"foo.test_thing=$(foo.test_thing)";
}
bundle agent foo {
vars:
"test_thing"
string => "I am here",
depends_on => { "delay_until_bundle_actuated" },
comment => "Since this promise depends on a promsie that is only actuated
during the full 3 pass convergence, it won't be defined unless the bundle
is called. Furthermore, it won't be defined unitl the second pass of the
bundle.";
commands:
"/bin/true" handle => "delay_until_bundle_actuated";
}
bundle agent main {
classes:
"something_exists"
expression => fileexists( "/tmpx" );
# I can change the above from /tmp to /tmpx and test_thing is always defined
methods:
something_exists::
"foo";
reports:
something_exists::
"something_exists is defined";
!something_exists::
"something_exists is NOT defined";
any::
"foo.test_thing=$(foo.test_thing)";
}