Because I am using cfengine in an environment where we are in the middle
of a slow rolling transition from one domain to another, I've written a
little script to determine the right domain for each client host at
runtime. The script has been fully tested and works perfectly given two
arguments: the IP address and the hostname. So in update.conf I have:
domain = ( ExecShellResult("/admin/bin/getdomain $(ipaddress)
$(host)") )
But that turns out not to work. cfagent -d -qv shows why, because a
bogus value is being used for $(host):
GNU Configuration Engine -
2.1.19p1
Free Software Foundation 1994-
Donated by Mark Burgess, Faculty of Engineering,
Oslo University College, Norway
------------------------------------------------------------------------
Host name is: asvap599
Operating System Type is sunos
Operating System Release is 5.10
Architecture = sun4v
Using internal soft-class solaris for host solaris
The time is now Thu Sep 7 17:17:02 2006
------------------------------------------------------------------------
[... MANY LINES SNIPPED...]
LVALUE domain
HandleLVALUE(domain) in action Control Defintions:
EQUALS =
LEFTBRACK
RVAL-FUNCTION ExecShellResult("/admin/bin/getdomain $(ipaddress)
$(host)")
HandleFunctionObject(ExecShellResult("/admin/bin/getdomain $(ipaddress)
$(host)"))
IsBuiltinFunction(ExecShellResult("/admin/bin/getdomain $(ipaddress)
$(host)"))
IsBuiltinFunction: ExecShellResult("/admin/bin/getdomain $(ipaddress)
HandleFunction: ExecShellResult("/admin/bin/getdomain $(ipaddress)
$(host)")
FunctionStringToCode(ExecShellResult)
ListArg[0]=(/admin/bin/getdomain $(ipaddress) $(host)")
ListArg[1]=(admin/bin/getdomain $(ipaddress) $(host)")
ListArg[2]=(dmin/bin/getdomain $(ipaddress) $(host)")
ListArg[3]=(min/bin/getdomain $(ipaddress) $(host)")
ListArg[4]=(in/bin/getdomain $(ipaddress) $(host)")
ListArg[5]=(n/bin/getdomain $(ipaddress) $(host)")
ListArg[6]=(/bin/getdomain $(ipaddress) $(host)")
ListArg[7]=(bin/getdomain $(ipaddress) $(host)")
ListArg[8]=(in/getdomain $(ipaddress) $(host)")
ListArg[9]=(n/getdomain $(ipaddress) $(host)")
ListArg[10]=(/getdomain $(ipaddress) $(host)")
ListArg[11]=(getdomain $(ipaddress) $(host)")
ListArg[12]=(etdomain $(ipaddress) $(host)")
ListArg[13]=(tdomain $(ipaddress) $(host)")
ListArg[14]=(domain $(ipaddress) $(host)")
ListArg[15]=(omain $(ipaddress) $(host)")
ListArg[16]=(main $(ipaddress) $(host)")
ListArg[17]=(ain $(ipaddress) $(host)")
ListArg[18]=(in $(ipaddress) $(host)")
ListArg[19]=(n $(ipaddress) $(host)")
ListArg[20]=( $(ipaddress) $(host)")
ListArg[21]=($(ipaddress) $(host)")
ListArg[22]=((ipaddress) $(host)")
ListArg[23]=(ipaddress) $(host)")
ListArg[24]=(paddress) $(host)")
ListArg[25]=(address) $(host)")
ListArg[26]=(ddress) $(host)")
ListArg[27]=(dress) $(host)")
ListArg[28]=(ress) $(host)")
ListArg[29]=(ess) $(host)")
ListArg[30]=(ss) $(host)")
ListArg[31]=(s) $(host)")
ListArg[32]=() $(host)")
ListArg[33]=( $(host)")
ListArg[34]=($(host)")
ListArg[35]=((host)")
ListArg[36]=(host)")
ListArg[37]=(ost)")
ListArg[38]=(st)")
ListArg[39]=(t)")
ListArg[40]=()")
Appending [/admin/bin/getdomain $(ipaddress) $(host)]
CFDEBUG: [/admin/bin/getdomain $(ipaddress) $(host)]
ExpandVarstring(/admin/bin/getdomain $(ipaddress) $(host))
ExtractInnerVarString(ipaddress) $(host)) - syntax verify
Returning substring value ipaddress
Scanning variable ipaddress
ExtractInnerVarString(host)) - syntax verify
Returning substring value host
Scanning variable host
ARG[0] /admin/bin/getdomain 10.136.101.59 32_bit
GetExecOutput(/admin/bin/getdomain 10.136.101.59 32_bit,)
cfpopen(/admin/bin/getdomain 10.136.101.59 32_bit)
--
Bill Cole Unix Administrator - Security, Email, & System
Standards
------------------------------------------------------------------------
--------
gedas USA, Inc., a Member of T-Systems
Operational Services Business Unit phone
+1-248-754-4384
3800 Hamlin Road, Mail Stop 2A05
[EMAIL PROTECTED]
Auburn Hills, MI 48326 USA
http://www.gedas.com
------------------------------------------------------------------------
--------
_______________________________________________
Bug-cfengine mailing list
[email protected]
http://cfengine.org/mailman/listinfo/bug-cfengine