In trying to make my policy more modular and easier to make changes I've developed what you see below (might be helpful to others). This nice thing about this is that adding or changing files can all be done in vars without having to touch the actual promise. The one problem is handling the slist 'files'. The first class under vars defines files to a set list. This list include some files common to Red Hat, Suse and Solaris hosts. Further down I have another slist for just Solaris hosts. Ideally I'd like to just append the existing list. Cf however does not seem to like that for it gives me this error: Scalar variable "files" contains itself (non-convergent): @{files} Variable "files" contains itself indirectly - an unkeepable promise
Is it possible to append a slist? bundle agent miscfilecontents { vars: redhat|suse|sunos_5_10:: "files" slist => { "iss", "motd", "warn" }, comment => "List of arrays (below) to index."; "iss[cmt]" string => "Check contents and permisssions."; "iss[trg]" string => "/etc/issue.net"; "iss[src]" string => "${g.masterfiles}/config/profiles/issue.net"; "iss[mod]" string => "0644"; "iss[usr]" string => "root"; "iss[grp]" string => "root"; "motd[cmt]" string => "Check contents and permisssions."; "motd[trg]" string => "/etc/motd"; "motd[src]" string => "${g.masterfiles}/config/profiles/motd"; "motd[mod]" string => "0644"; "motd[usr]" string => "root"; "motd[grp]" string => "root"; "warn[cmt]" string => "Check contents and permisssions."; "warn[trg]" string => "/etc/warning"; "warn[src]" string => "${g.masterfiles}/config/profiles/warning"; "warn[mod]" string => "0644"; "warn[usr]" string => "root"; "warn[grp]" string => "root"; sunos_5_10:: "files" slist => { "@{files}", "xacc", "tmp", "tmp2", "tmp3" }, comment => "List of arrays (below) to index."; "xacc[cmt]" string => "Check contents and permisssions."; "xacc[trg]" string => "/etc/dt/config/Xaccess"; "xacc[src]" string => "${g.masterfiles}/config/misc-files/Xaccess"; "xacc[mod]" string => "0644"; "xacc[usr]" string => "root"; "xacc[grp]" string => "root"; "tmp[cmt]" string => "Check contents and permisssions."; "tmp[trg]" string => "/etc/init.d/set-tmp-permissions"; "tmp[src]" string => "${g.masterfiles}/config/misc-files/set-tmp-permissions"; "tmp[mod]" string => "0644"; "tmp[usr]" string => "root"; "tmp[grp]" string => "root"; "tmp2[cmt]" string => "Check contents and permisssions."; "tmp2[trg]" string => "/etc/rc2.d/S00set-tmp-permissions"; "tmp2[src]" string => "${g.masterfiles}/config/misc-files/S00set-tmp-permissions"; "tmp2[mod]" string => "0644"; "tmp2[usr]" string => "root"; "tmp2[grp]" string => "root"; "tmp3[cmt]" string => "Check contents and permisssions."; "tmp3[trg]" string => "/etc/rc2.d/S07set-tmp-permissions"; "tmp3[src]" string => "${g.masterfiles}/config/misc-files/S07set-tmp-permissions"; "tmp3[mod]" string => "0644"; "tmp3[usr]" string => "root"; "tmp3[grp]" string => "root"; methods: redhat|suse|sunos_5_10:: "any" usebundle => filecontents( "${${files}[trg]}", "${${files}[src]}", "${${files}[mod]}", "${${files}[usr]}", "${${files}[grp]}", "${${files}[cmt]}" ); } Sincerely, -- Neil Watson 416-673-3465
CONFIDENTIALITY WARNING This communication, including any attachments, is for the exclusive use of addressee and may contain proprietary and/or confidential information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this communication and destroy all copies. AVERTISSEMENT RELATIF À LA CONFIDENTIALITÉ Ce message, ainsi que les pièces qui y sont jointes, est destiné à l’usage exclusif de la personne à laquelle il s’adresse et peut contenir de l’information personnelle ou confidentielle. Si le lecteur de ce message n’en est pas le destinataire, nous l’avisons par la présente que toute diffusion, distribution, reproduction ou utilisation de son contenu est strictement interdite. Veuillez avertir sur-le-champ l’expéditeur par retour de courrier électronique et supprimez ce message ainsi que toutes les pièces jointes.
_______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine