Hi,
I want to set the variable policyhost with the following ExecResult line
(I escaped already some of the ' and " because I found that in the
groups):
policyhost = ( ExecResult("/bin/hostname -i | /usr/bin/awk -F\".\"
\'{ print $1\".\"$2\".\"$3\".\"200 }\'") )
(I.e. append a .200 to the current IP)
This does not work:
RecordMacroId(policyhost)
HandleFunctionObject(ExecResult("/bin/hostname -i | /usr/bin/awk -F\".\"
\'{ print $1\".\"$2\".\"$3\".\"200 }\'"))
IsBuiltinFunction(ExecResult("/bin/hostname -i | /usr/bin/awk -F\".\"
\'{ print $1\".\"$2\".\"$3\".\"200 }\'"))
IsBuiltinFunction: ExecResult("/bin/hostname -i | /usr/bin/awk -F\".\"
\'{ print $1\".\"$2\".\"$3\".\"200 }\'")
HandleFunction: ExecResult("/bin/hostname -i | /usr/bin/awk -F\".\"
\'{ print $1\".\"$2\".\"$3\".\"200 }\'")
FunctionStringToCode(ExecResult)
Appending [/bin/hostname -i | /usr/bin/awk -F"." '{ print
$1"."$2"."$3"."200 }']
ListArg[0]=(/bin/hostname -i | /usr/bin/awk -F"." '{ print
$1"."$2"."$3"."200 }'
)
Check ListLen
ExpandVarstring( /bin/hostname -i | /usr/bin/awk -F"." '{ print
$1"."$2"."$3"."200 }' )
Add |/bin/hostname -i | /usr/bin/awk -F"." '{ print | to str, waiting at
|$1"."$2"."$3"."200 }'|
Add |/bin/hostname -i | /usr/bin/awk -F"." '{ print $1"."| to str,
waiting at |$2"."$3"."200 }'|
Add |/bin/hostname -i | /usr/bin/awk -F"." '{ print $1"."$2"."| to str,
waiting at |$3"."200 }'|
Add |/bin/hostname -i | /usr/bin/awk -F"." '{ print
$1"."$2"."$3"."200 }'| to str, waiting at ||
Returning varstring (/bin/hostname -i | /usr/bin/awk -F"." '{ print
$1"."$2"."$3"."200 }')
ARG[0] /bin/hostname -i | /usr/bin/awk -F"." '{ print
$1"."$2"."$3"."200 }'
cfpopen(/bin/hostname -i | /usr/bin/awk -F"." '{ print
$1"."$2"."$3"."200 }')
GetExecOutput got: [10.1.2.101]
cfpclose(pp)
It should give 10.1.2.200! I assume, the | close the string. cfpopen
shows the right command, which would give the expected result, but is
not.
I upgraded already to the svn trunk 2.2.1a1, no difference to 2.2.0.
Any help is appreciated.
Greetings,
Marc
--
** Disclaimer: My views/comments/beliefs, as strange as they are, are my
own.**
_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine