On 8/9/2010 6:23 PM, Christopher Johnston wrote:
Why can't variables be reassigned with a setup like this?

node /.*mydomain.com/ <http://mydomain.com/> {
   import mydomain.pp
}

node /*.yourdomain.com/ <http://yourdomain.com/> {
   import yourdomain.pp
}

In manifest mydomain.pp and yourdomain.pp I have variables that are
specific to that site that I want to import only for that site (ie,
dns_nameserver ldap_server).  I get errors that variable cannot be
reassigned.  My reasoning for wanting to separate everything into
separate site specific manifests is mostly because my nodes.pp is
getting way too cluttered and difficult to manage (over 1k lines of
code).  It looks like stuff is getting imported regardless of the node
type (case statements also show the same behavior).

err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Cannot reassign variable site_id at
/etc/puppet/manifests/nodes/mydomain.pp:5 on node host.yourdomain.com
<http://host.yourdomain.com>


Because, AFAIUI, imports are not constrained by their surrounding scope. That means that top-level variables in a file will always be added to the ::main scope, regardless of how they're imported.

Either put the nodes statement into the imported files too, or inline the imported files instead, or use a facility like extlookup, or use an external node classifier.


Best Regards, David
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

       FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to