[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: include/import/ReadFile usage
From: |
Brendan Strejcek |
Subject: |
Re: include/import/ReadFile usage |
Date: |
Wed, 3 Mar 2004 19:39:42 -0600 |
User-agent: |
Mutt/1.3.28i |
Lev Lvovsky wrote:
> So after solving the issue of lists and cfservd, I'm looking for a
> way to make the lists in separate files, and then include them in the
> cfservd.conf.
I confess to not having read your previous posts closely, so maybe this
does not address your problem at all, but...
> per my understanding of "import", it's a section outside of "control",
> therefore I can't "import" a file which defines lists within it into
> the control section.
I think of import more as merging or interleaving the content of
multiple files, while preserving some important ordering.
# begin cfagent.conf
import: lists
control:
actionsequence = ( shellcommands )
list_main = ( "one two three" )
shellcommands:
"/bin/echo ${list_main}"
"/bin/echo ${list_included}"
# end cfagent.conf
# begin list
control: list_included = ( "foo bar baz" )
# end list
$ cfagent -qK
cfengine:morse:/bin/echo one t: one two three
cfengine:morse:/bin/echo foo b: foo bar baz
Just ignore me if I'm off base.
> If possible, could someone give me an idea of the format of the file
> which ReadFile() reads, as all of the formats I've tried caused parse
> errors.
There is also var = ( ExecResult(/bin/cat filename) )
Interestingly, with the following file:
$ cat /tmp/colors
red yellow green
purple orange blue
and the following additions to the cfagent.conf control section:
colors = ( ReadFile(/tmp/colors, 1000) )
cat = ( ExecResult(/bin/cat /tmp/colors) )
(and a few more echos in shellcommands) I get this:
$ cfagent -qK
cfengine:morse:/bin/echo one t: one two three
cfengine:morse:/bin/echo foo b: foo bar baz
cfengine:morse:/bin/echo red y: red yellow green
cfengine:morse:/bin/echo red y: sh: purple: command not found
cfengine:morse:/bin/echo red y: red yellow green purple orange blue