I just compared your bundle to mine and found the problem. I was doing this in a common bundle while yours is in an agent bundle. I seem to recall a similar problem to this but I don't remember the details. I changed mine to an agent bundle and it worked fine, but I'd like to do it in a common bundle for global access. Is this a technical limitation with how common bundles work?
Justin -----Original Message----- From: Daniel V Klein [mailto:d...@lonewolf.com] Sent: Monday, May 17, 2010 4:43 PM To: Justin Lloyd Cc: help-cfengine@cfengine.org Subject: Re: Problem defining classes from an slist I am not sure what you're doing worng. The following bundle works just fine for me... I did "cf-agent -Kb foo -f ./justin.cf" -Dan bundle agent foo { vars: "logs" slist => { "foo", "bar", "gar-bletch" }; "canonified[$(logs)]" string => canonify("$(logs)"); classes: "$(canonified[$(logs)])_exists" expression => fileexists("/var/adm/$(logs)") ; reports: cfengine_3:: "$(canonified[$(logs)])_exists"; } > FWIW, I just found out that this does not work: > > vars: > "logs" slist => { "foo", "bar" }; > "canonified[$(logs)]" string => canonify("$(logs)"); > > classes: > "$(canonified[$(logs)])_exists" expression => > fileexists("/var/adm/$(logs)"); > > It gives the same error about illegal characters. > > Justin > > -----Original Message----- > From: help-cfengine-boun...@cfengine.org > [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of Justin Lloyd > Sent: Monday, May 17, 2010 12:25 PM > To: help-cfengine@cfengine.org > Subject: Problem defining classes from an slist > > I have an slist variable, named "logs", of logfile names and just ran > into a problem when I added a filename with a hyphen in it, breaking > this classes promise: > > "$(logs)_exists" expression => fileexists("/var/adm/$(logs)"); > > Running cf-promises on the .cf file returns the following message: > > !! Class identifier "syslog-ng_exists" contains illegal characters > > Since canonify and classify can only be used on the right-hand side of a > class definition, I'm not sure how to cleanly allow for filenames with > characters that cannot appear in classes. (FWIW, I am defining whether > each file in the slist exists to know whether I need to rotate the > file.) > > Any suggestions? > > Thanks, > Justin > > -- > Justin C. Lloyd > Unix Infrastructure Engineer > DigitalGlobe, An Imaging and Information Company > > > > This electronic communication and any attachments may contain > confidential and proprietary > information of DigitalGlobe, Inc. If you are not the intended recipient, > or an agent or employee > responsible for delivering this communication to the intended recipient, > or if you have received > this communication in error, please do not print, copy, retransmit, > disseminate or > otherwise use the information. Please indicate to the sender that you > have received this > communication in error, and delete the copy you received. DigitalGlobe > reserves the > right to monitor any electronic communication sent or received by its > employees, agents > or representatives. > > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine > _______________________________________________ > Help-cfengine mailing list > Help-cfengine@cfengine.org > https://cfengine.org/mailman/listinfo/help-cfengine This electronic communication and any attachments may contain confidential and proprietary information of DigitalGlobe, Inc. If you are not the intended recipient, or an agent or employee responsible for delivering this communication to the intended recipient, or if you have received this communication in error, please do not print, copy, retransmit, disseminate or otherwise use the information. Please indicate to the sender that you have received this communication in error, and delete the copy you received. DigitalGlobe reserves the right to monitor any electronic communication sent or received by its employees, agents or representatives. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine