On Wed, 20 Jul 2016 08:53:30 -0700 (PDT)
ruisse...@gmail.com wrote:
r> I'm using
r> "url" string =>
r> "
http://servername/hostinfo.php?hostname=$(hostname)&exportType=cfengine3";
r> "res" data => url_get($(url), options);
r> # "list" slist => getvalues( "res[content]" );
r> "out" string => format("%S", res);
r> reports:
r> "$(out)";
r> "$(output[content])";
r> "$(res)"
r> report_to_file => "$(targetdir)/$(hostname).cf"
r> and I get the following content
r> R: $(list) {"content":"realcontent","headers":"HTTP/1.1 200
r> OK\r\nContent-Type: application/cfengine3\r\nServer:
r> Microsoft-IIS/7.5\r\nX-Powered-By: PHP/5.3.8\r\nX-Powered-By:
r>
ASP.NET\r\nDate: date GMT\r\nContent-Length:
r> 1588\r\n\r\n","rc":0,"returncode":200,"success":true}
r> realcontent is really 300 lines of host specific cfengine code which I want
r> to write to $(hostname).cf
r> Can anybody help me achieve this.?
Please post runnable self-contained examples. Trying to figure out your
actual code; I would check that "success" is true. Then:
vars: "mydata" string => nth("content", res); # and then write mydata to a file as usual
... or ...
reports:
"$(res[content])"
report_to_file => "$(targetdir)/$(hostname).cf"
That has a limit of 4Kb I think, test to be sure it works for you.
r> I should also be canonified and I want to maintain the format (newlines
r> etc).
Sorry, I don't know what this means.
Ted