Bug with ${const.dollar}() and a variable substitution.

Jean-Noël Rivasseau <[email protected]> Fri, 5 Feb 2010 12:47:00 -0800
Newsgroups gmane.comp.sysutils.cfengine.bugs
Message-ID <[email protected]>
--===============1818041171==
Content-Type: multipart/alternative; boundary=001517447eea9a05c2047ee08dd0

--001517447eea9a05c2047ee08dd0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I reported the issue in Mantis:

http://bug.cfengine.com/view.php?id=3D35

You get

!? Unresolved or non-existent variables in function call arguments, skippin=
g

on the following promise file:

body common control
{
    bundlesequence =3D> {"try"};
}

bundle agent try
{
    methods:
        "any" usebundle =3D> tryBundle("password");
}

bundle agent tryBundle(argument)
{
    classes:
        "DoesNotWork" expression =3D> returnszero("/bin/echo
${const.dollar}(cat ${argument})", "useshell");
        #"Works" expression =3D> returnszero("/bin/echo
${const.dollar}(/bin/cat ${argument})", "useshell");
        #"AlsoWorks" expression =3D> returnszero("/bin/echo
${const.dollar}(cat /etc/${argument})", "useshell");

    commands:
    DoesNotWork::
        "/bin/echo Hello";
}

body contain shell
{
    useshell =3D> "true";
}

Note the promise file is deliberately wrong, but the point is that the
command is not loaded at all, whereas it should be (My actual policy file
uses mysql instead of cat, with an argument which makes sense).

Thanks

--=20
Jean-No=C3=ABl Rivasseau

--001517447eea9a05c2047ee08dd0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I reported the issue in Mantis:<br><br><a href=3D"http://bug.cfengine.com/v=
iew.php?id=3D35">http://bug.cfengine.com/view.php?id=3D35</a><br><br>You ge=
t<br><br>!? Unresolved or non-existent variables in function call arguments=
, skipping<br>
<br>on the following promise file:<br><br>body common control<br>{<br>=C2=
=A0=C2=A0=C2=A0 bundlesequence =3D&gt; {&quot;try&quot;};<br>}<br><br>bundl=
e agent try<br>{<br>=C2=A0=C2=A0=C2=A0 methods:<br>=C2=A0=C2=A0=C2=A0 =C2=
=A0=C2=A0=C2=A0 &quot;any&quot; usebundle =3D&gt; tryBundle(&quot;password&=
quot;);<br>
}<br><br>bundle agent tryBundle(argument)<br>{<br>=C2=A0=C2=A0=C2=A0 classe=
s:<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 &quot;DoesNotWork&quot; express=
ion =3D&gt; returnszero(&quot;/bin/echo ${const.dollar}(cat ${argument})&qu=
ot;, &quot;useshell&quot;);<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #&quot=
;Works&quot; expression =3D&gt; returnszero(&quot;/bin/echo ${const.dollar}=
(/bin/cat ${argument})&quot;, &quot;useshell&quot;);<br>
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #&quot;AlsoWorks&quot; expression =3D=
&gt; returnszero(&quot;/bin/echo ${const.dollar}(cat /etc/${argument})&quot=
;, &quot;useshell&quot;);<br><br>=C2=A0=C2=A0=C2=A0 commands:<br>=C2=A0=C2=
=A0=C2=A0 DoesNotWork::<br>=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 &quot;/bin=
/echo Hello&quot;;<br>
}<br><br>body contain shell<br>{<br>=C2=A0=C2=A0=C2=A0 useshell =3D&gt; &qu=
ot;true&quot;;<br>}<br clear=3D"all"><br>Note the promise file is deliberat=
ely wrong, but the point is that the command is not loaded at all, whereas =
it should be (My actual policy file uses mysql instead of cat, with an argu=
ment which makes sense).<br>
<br>Thanks<br><br>-- <br>Jean-No=C3=ABl Rivasseau<br><br>

--001517447eea9a05c2047ee08dd0--

--===============1818041171==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine

--===============1818041171==--