I'm trying to verify that a file with a bunch of VAR="value" entries is
being read into an array variable correctly. I have the following:

vars:
    asset_cache_exists::
            "num_asset_cache_entries" int => readstringarray(
                "asset_cache", "$(dg.asset_cache_file)", "#[^\n]*", "=",
30, 3000
            );

            "at_fields" slist => getindices("asset_cache");

reports:
    asset_cache_exists::
        "$(at_fields) ==> $(asset_cache[$(at_fields)])";

The class "asset_cache_exists" is defined in another file and is being
correctly set.

Given $(dg.asset_cache_file) file contents like this:

AT_NAME="gdcscf3lgmt01"
AT_TYPE="Virtual"
AT_STATUS="commission"
AT_DESCRIPTION="Cfengine Policy Server for Production Environment"
AT_LAST_UPDATED="Wed Mar 10 00:03:22 GMT+00:00 2010"
AT_DG_STRING="Gold"
AT_OS_TYPE="linux"

I'm getting output like this:

R: AT_NAME ==> $(asset_cache[AT_NAME])
R: AT_TYPE ==> $(asset_cache[AT_TYPE])
R: AT_STATUS ==> $(asset_cache[AT_STATUS])
R: AT_DESCRIPTION ==> $(asset_cache[AT_DESCRIPTION])
R: AT_LAST_UPDATED ==> $(asset_cache[AT_LAST_UPDATED])
R: AT_DG_STRING ==> $(asset_cache[AT_DG_STRING])
R: AT_OS_TYPE ==> $(asset_cache[AT_OS_TYPE])

Is there anything immediately obvious about my promises for why the
array value is not getting printed?

Thanks,
Justin


-- 
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