Issue #5138 has been reported by Henning Henkel.

----------------------------------------
Bug #5138: Template in Module / Class gets dealed with even if not relevant for 
node
https://projects.puppetlabs.com/issues/5138

Author: Henning Henkel
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 0.25.5
Keywords: template variable external node
Branch: 


I got an environment with a puppetmaster and a external node script. There are 
3 different nodes (puppetmaster, nodeA, nodeB) which all got the "common" 
module in common. nodeB got an additional module "weblogic" which contains the 
class "weblogic::logrotate". When running puppetd on puppetmaster and nodeA 
everything is fine, this changes when puppetd ran on nodeB (successful 
requiring the additional modul). After this moment the other two nodes fail as 
the variable that in the template is used is not set for those nodes:

 
<pre>
$ puppetd --server puppetmaster.some-company.ads --test --waitforcert 60
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed 
to parse template weblogic/logrotate.erb: Could not find value for 
'wlsuser_base_path' at 
/etc/puppet/prestable/modules/weblogic/manifests/logrotate.pp:10 on node 
nodeA.some-company.ads
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
</pre>



<pre>
class weblogic::logrotate{
  $logrotateFile = "/etc/logrotate.d/weblogic"
  # Logrotation

  file{ "$logrotateFile":
    owner => "root",
    group => "root",
    mode => "0644",
    replace => true,
    content => template("weblogic/logrotate.erb");
  }

  # Logrotation
  cron { "logrotateWLS":
    command => "/usr/sbin/logrotate $logrotateFile",
    user => "root",
    hour => 2,
    minute => 0
  }
}
</pre>


The template is:
<pre>
/var/log/weblogic.log {
    daily
    rotate 7
    missingok
}

<%= wlsuser_base_path %>/domains/*/servers/*/logs/*.out {
  copytruncate
  rotate 5
  size=10M
}

<%= wlsuser_base_path %>/domains/*/servers/*/logs/*.log {
  copytruncate
  rotate 5
  size=10M
}
</pre>

the external node script ( underlined for formating reasons ):
<pre>
#!/bin/sh

case $1 in

  tvvvgslwww002*)
    cat <<<ins>EOF</ins>
---
classes:
  - common
  - weblogic
environment: prestable
parameters:
  future_environment: prestable
  puppetmaster: tvvvgslmgt001.sympany-test.ads
  puppet_server: tvvvgslmgt001.sympany-test.ads
  dns_server: tvvvgsmdom001.sympany-test.ads
  wls_version: 10.3.3.0
  jrmc_version: 4.0.1-1.6.0
  wlsuser_base_path: /opt/user_projects
EOF
;;
  *)
    cat <<<ins>EOF</ins>
---
classes:
  - common
environment: prestable
parameters:
  future_environment: prestable
  puppetmaster: tvvvgslmgt001.sympany-test.ads
  puppet_server: tvvvgslmgt001.sympany-test.ads
  dns_server: tvvvgsmdom001.sympany-test.ads
EOF
;;
esac 
exit 0
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to