I have not taested this, but I think you could have the module declare an
array variable...

body agent your_module(parm)
{
vars:
   "output[$parm]" string => execresult("verylongandcomplexcommandhere 
myArgument");
}

Then you when you
        modules:
            "whatever" usebundle => your_module("foo");

would later reference $(your_module.output[foo])

It's worth a try...  If that fails, you could send the results of your
command to a file, and read the contents of the file.  Less efficient,
but you still have Unix buffering on your side...

-Dan

> --===============1183641646==
> Content-Type: multipart/alternative; boundary=001636283b6839f3910483c33a65
> 
> --001636283b6839f3910483c33a65
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
> 
> Hello,
> 
> There is an execresult function that I use quite a lot to fill a variable i=
> n
> my bundles. Is it possible to somehow modularize that in a method and have
> the variable somehow be some kind of "output" from the method?
> 
> What I mean is that I have many places in my code where I do:
> 
> vars:
>  foo string =3D> execresult("verylongandcomplexcommandhere myArgument");
> 
> and I'd like to avoid repeating this code all the time. Any options to do
> that?
> 
> --=20
> Jean-No=C3=ABl Rivasseau
> 
> --001636283b6839f3910483c33a65
> Content-Type: text/html; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
> 
> Hello,<br><br>There is an execresult function that I use quite a lot to fil=
> l a variable in my bundles. Is it possible to somehow modularize that in a =
> method and have the variable somehow be some kind of &quot;output&quot; fro=
> m the method?<br>
> <br>What I mean is that I have many places in my code where I do:<br><br>va=
> rs:<br>=C2=A0foo string =3D&gt; execresult(&quot;verylongandcomplexcommandh=
> ere myArgument&quot;);<br clear=3D"all"><br>and I&#39;d like to avoid repea=
> ting this code all the time. Any options to do that?<br>
> <br>-- <br>Jean-No=C3=ABl Rivasseau<br><br>
> 
> --001636283b6839f3910483c33a65--
> 
> --===============1183641646==
> Content-Type: text/plain; charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
> 
> --===============1183641646==--
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to