Hi, Diego.   I bet this is related to bug 0000726: data typing is less
strict in 3.2.0 and this change is not documented

Yours,
Aleksey

https://cfengine.com/bugtracker/view.php?id=726

Status:  new  (not assigned)


Data typing used to be strict, but now isn't. I don't see anything in
the ChangeLog about this.

Here is the strict typing, with 3.1.5:
[cfengine01 - App server #1 ~]# cat
0145_Basic_Examples._Be_a_variable._Strict_typing.cf
bundle agent example {

    vars:

        "my_int"

            int => "1.5";

    commands:

        "/bin/echo my int is $(my_int)";

}
[cfengine01 - App server #1 ~]# cf-agent -f
./0145_Basic_Examples._Be_a_variable._Strict_typing.cf -b example
cf3> ./0145_Basic_Examples._Be_a_variable._Strict_typing.cf:14,0:
Error reading assumed integer value "1.5" => "non-value" (found
remainder "5")
, near token ''
cf3> ./0145_Basic_Examples._Be_a_variable._Strict_typing.cf:14,0:
Error reading assumed integer value "1.5" => "non-value" (found
remainder "5")
, near token ''
Fatal cfengine error: Validation: Error reading assumed integer value
"1.5" => "non-value" (found remainder "5")
cf-agent was not able to get confirmation of promises from
cf-promises, so going to failsafe
Bundle "example" listed in the bundlesequence was not found
Fatal cfengine error: Errors in agent bundles
[cfengine01 - App server #1 ~]#


And here is the same policy run under 3.2.0b3:

[cfengine00 practical_examples]# cf-agent -f
./0145_Basic_Examples._Be_a_variable._Strict_typing.cf -b example
Q: ".../bin/echo my in": my int is 1
I: Last 1 quoted lines were generated by promiser "/bin/echo my int is 1"
[cfengine00 practical_examples]#

Could you please fix the product or update the documentation?

Cheers,
Aleksey



On Thu, Sep 22, 2011 at 10:02 PM,  <[email protected]> wrote:
> Forum: CFEngine Help
> Subject: ilist assignment does not validate integer values
> Author: zzamboni
> Link to topic: https://cfengine.com/forum/read.php?3,23589,23589#msg-23589
>
> Hi,
>
> According to the manual:
>
> Integer lists are lists of strings that are expected to be treated as 
> integers. The typing in CFEngine is dynamic, so the variable types are 
> interchangable, but when you declare a variable to be type ilist, CFEngine 
> verifies that each value you assign to it looks like an integer (e.g., ‘3’, 
> ‘-17’, ‘16K’, etc).
>
> This doesn't seem to be the case for integer lists (ilist). Consider this 
> example:
>
> body common control {
>  bundlesequence => { "test" };
> }
>
> bundle agent test
> {
>  vars:
>    "l1" ilist => { "1", "2", "3.5", "blah" };
>
>  reports:
>    cfengine::
>      "l1 = $(l1)";
> }
>
> It should fail. Instead, it runs correctly (this is with 3.2.1):
>
> $ cf-agent -KI -f ./src/vars_list_examples.cfbrew edit cfenginehelp
> R: l1 = 1
> R: l1 = 2
> R: l1 = 3.5
> R: l1 = blah
>
> For lists there does seem to be some validation. If I change the list 
> assignment to "rlist" instead of "ilist", it does produce an error:
>
> $ cf-agent -KI -f ./src/vars_list_examples.cf
> cf3> ./src/vars_list_examples.cf:8,45: Error reading assumed real value blah 
> (anomalous remainder )
> , near token '}'
> Fatal cfengine error: Validation: Error reading assumed real value blah 
> (anomalous remainder )
>
> Is this a bug, or am I missing something?
>
> Thanks,
>
> _______________________________________________
> Help-cfengine mailing list
> [email protected]
> https://cfengine.org/mailman/listinfo/help-cfengine
>
_______________________________________________
Help-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to