I should be able to define a class in one bundle and use it in another.
However, in the following example, the "curl_command_exists" class I
define in the _verify_curl_command bundle doesn't appear to be available
to the _verify_asset_command bundle.

[r...@gdcscf3lgmt01 masterfiles.devel]# cf-agent -Kf ./test.asset.cf 
R: /usr/bin/curl exists
[r...@gdcscf3lgmt01 masterfiles.devel]# cf-agent -vKf ./test.asset.cf
...<snipped for brevity>...
nova>    =========================================================
nova>    classes in bundle _verify_curl_command (1)
nova>    =========================================================
nova> 
nova> 
nova>      +  Private classes augmented:
nova>      +       curl_command_exists
...<snipped for brevity>...
nova>    =========================================================
nova>    vars in bundle _verify_asset_command (1)
nova>    =========================================================
nova> 
nova> 
nova> . . . . . . . . . . . . . . . . . . . . . . . . . . . .
nova> Skipping whole next promise (asset_command), as context
curl_command_exists is not relevant
...<snipped for brevity>...
[r...@gdcscf3lgmt01 masterfiles.devel]# 

Here is the contents of test.asset.cf, which is pretty simple. Can
anyone see if I'm doing something wrong? I realize I should probably
check for the command before even calling the _verify_asset_command
bundle, and I may take that approach, but I'm wondering why what I'm
trying is not working. 

#----- begin test.asset.cf -----
body common control {
    bundlesequence => { "asset" };
            inputs => { "cfengine_stdlib.cf" };
}

bundle agent asset {
    methods:
         "verify_curl" usebundle => _verify_curl_command;
        "verify_asset" usebundle => _verify_asset_command;
}

bundle agent _verify_curl_command {
    vars:
        linux::
            "curl_command" string => "/usr/bin/curl";
        solaris::
            "curl_command" string => "/usr/local/bin/curl";

    classes:
        "curl_command_exists" expression =>
fileexists("$(curl_command)");

    reports:
        curl_command_exists::
            "$(curl_command) exists";
}

bundle agent _verify_asset_command {
    vars:
        curl_command_exists::
            "asset_command" string => "/usr/local/bin/asset";

    classes:
        "asset_command_exists" expression =>
fileexists("$(asset_command)");

    reports:
        asset_command_exists::
            "$(asset_command) exists";
}
#----- end test.asset.cf -----

-- 
Justin C. Lloyd 
Unix Infrastructure Engineer 
DigitalGlobe, An Imaging and Information Company



This electronic communication and any attachments may contain confidential and 
proprietary 
information of DigitalGlobe, Inc. If you are not the intended recipient, or an 
agent or employee 
responsible for delivering this communication to the intended recipient, or if 
you have received 
this communication in error, please do not print, copy, retransmit, disseminate 
or 
otherwise use the information. Please indicate to the sender that you have 
received this 
communication in error, and delete the copy you received. DigitalGlobe reserves 
the 
right to monitor any electronic communication sent or received by its 
employees, agents 
or representatives.

_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to