I am tidying up my policies a bit and thought it was a good idea to
put various common settings into a common bundle. This works fine for
regular text variables, but I had problems referring to globally
defined slists (see tester1 below). The kludge I came up with (see
tester2 below) was to copy the global slist into a local in the vars
section and then use the local copy. There must be a better way?

- Erlend


r...@nrsscdev01:master$ cat tester.cf
#------------------------------------------------------------------------
body common control{
   bundlesequence=>{"tester0","tester1","tester2"};
}

#------------------------------------------------------------------------
bundle common g{
vars:
   "kilroy" string => "kilroy was here";
   "listglobal" slist => { "d","e","f"};
}

#------------------------------------------------------------------------
bundle agent tester0{
vars:
   "listlocal" slist => { "a","b","c"};
reports:
   solaris::
      "listlocal: ${g.kilroy} - ${listlocal}";
}

#------------------------------------------------------------------------
bundle agent tester1{
reports:
   solaris::
      "listglobal: ${g.kilroy} - $(g.listglobal)";
}

#------------------------------------------------------------------------
bundle agent tester2{
vars:
   "listlocalglobal" slist => {...@{g.listglobal}};
reports:
   solaris::
      "listlocalglobal: ${g.kilroy} - ${listlocalglobal}";
}
r...@nrsscdev01:master$ /var/cfengine/bin/cf-agent -KIf ./tester.cf
R: listlocal: kilroy was here - a
R: listlocal: kilroy was here - b
R: listlocal: kilroy was here - c
R: listglobal: kilroy was here - $(g.listglobal)
R: listlocalglobal: kilroy was here - d
R: listlocalglobal: kilroy was here - e
R: listlocalglobal: kilroy was here - f
r...@nrsscdev01:master$ /var/cfengine/bin/cf-agent --version
This comprises cf-agent core community version 3.1.2 - Copyright
Copyright (C) Cfengine AS 2008,2010-
r...@nrsscdev01:master$
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to