On 09/12/2016 05:55 AM, Christian Linden wrote:
> Hi,
>
> how can I test in bundle local_two on the "one" class in `bundle
> local_one, pls?
I am not certain that I understand what your asking. I think you are
probably referring to this policy based on the URL in the subject.
,----
| body common control
| {
| bundlesequence => { "global","local_one", "local_two" };
| }
|
| #################################
|
| bundle common global
| {
| classes:
| # The soft class "zero" is always satisfied,
| # and is global in scope
| "zero" expression => "any";
| }
|
| #################################
|
| bundle agent local_one
| {
| classes:
| # The soft class "one" is always satisfied,
| # and is local in scope to local_one
| "one" expression => "any";
| }
|
| #################################
|
| bundle agent local_two
| {
| classes:
| # The soft class "two" is always satisfied,
| # and is local in scope to ls_2
| "two" expression => "any";
|
| reports:
| zero.!one.two::
| # This report will be generated
| "Success";
| }
`----
And I think you might be asking how to check if the class `one'
defined in `bundle agent local_one' can be seen from `bundle agent
local_two'. If so, note that `Success' is only emitted if the class
`zero' is defined, the class `one' is not defined, and the class `two'
is defined.
You could add some additional reports:
,----
| bundle agent local_two
| {
| classes:
| # The soft class "two" is always satisfied,
| # and is local in scope to ls_2
| "two" expression => "any";
|
| reports:
| zero.!one.two::
| # This report will be generated
| "Success";
|
| !one::
| "The class =one= is NOT defined (or not available based on
its scope).";
| }
`----
If you are wondering how you cold make the class `one' that is defined
in `bundle agent local_one' available for use in `bundle agent
local_two' you can do so by adjusting the scope of the class when it
is defined.
For example you can explicitly set the scope:
,----
| bundle agent local_one
| {
| classes:
| # The soft class "one" is always satisfied,
| # and is global in scope
| "one" expression => "any", scope => "namespace";
| }
`----
Classes defined as the result of a classes type promise in agent
bundles are by default bundle scoped. Classes defined as the result of
a classes type promise in common bundles are by default namespace
scoped.
Hope this helps.