So, I’m using templates for the first time and I wanted to test the case where the values used by the template don’t exist. I get an error like this: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template slapd_replication.erb: Could not find value for ''slapd_consumer_rid'' at /etc/puppet/manifests/experimental/services/ldap.pp:141 on node t-corp-ldap-03 warning: Not using cache on failed catalog err: Could not retrieve catalog; skipping run That’s fine. I want it to fail and not touch the target file (which is what happens), but I also want to *know* it failed. The report in Puppet Dashboard shows a successful run. I imagine the report only counts something as a failure if it attempts to do it, but since the template can’t even be parsed, it’s not trying. Is there some clever thing I can do to make it fail in a way that will get reported? One possibility I’ve considered is to check for the variable in the template and set an invalid default if it’s missing, which will kill LDAP services on that node. While that would certainly get noticed, I’d prefer something less extreme. And a related question: I’d like to store templates in the same directory that ''puppet://puppet/files/'' points to, but I don’t want to hard-code the path in my manifests. Is there a variable that refers to that path? (Yeah, I know. Modules. I’m not using them and not planning to any time soon, so any other ideas would be appreciated.) Thanks. -- Rob McBroom <http://www.skurfer.com/> Don''t try to tell me something is important to you if the whole of your “support” entails getting Congress to force *others* to spend time and money on it. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Christopher Johnston
2010-Jul-28 22:39 UTC
Re: [Puppet Users] Catching failure with templates
To solve your pathing issue you could create a define to autocomplete the path for you. Sent from my iPhone On Jul 27, 2010, at 11:24 AM, Rob McBroom <mailinglist0@skurfer.com> wrote:> So, I’m using templates for the first time and I wanted to test the case where the values used by the template don’t exist. I get an error like this: > > err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template slapd_replication.erb: Could not find value for ''slapd_consumer_rid'' at /etc/puppet/manifests/experimental/services/ldap.pp:141 on node t-corp-ldap-03 > warning: Not using cache on failed catalog > err: Could not retrieve catalog; skipping run > > That’s fine. I want it to fail and not touch the target file (which is what happens), but I also want to *know* it failed. The report in Puppet Dashboard shows a successful run. I imagine the report only counts something as a failure if it attempts to do it, but since the template can’t even be parsed, it’s not trying. Is there some clever thing I can do to make it fail in a way that will get reported? > > One possibility I’ve considered is to check for the variable in the template and set an invalid default if it’s missing, which will kill LDAP services on that node. While that would certainly get noticed, I’d prefer something less extreme. > > And a related question: I’d like to store templates in the same directory that ''puppet://puppet/files/'' points to, but I don’t want to hard-code the path in my manifests. Is there a variable that refers to that path? (Yeah, I know. Modules. I’m not using them and not planning to any time soon, so any other ideas would be appreciated.) > > Thanks. > > -- > Rob McBroom > <http://www.skurfer.com/> > > Don''t try to tell me something is important to you if the whole of your “support” entails getting Congress to force *others* to spend time and money on it. > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Jul 28, 2010, at 6:39 PM, Christopher Johnston wrote:> To solve your pathing issue you could create a define to autocomplete the path for you.I got that part figured out. I just set “templatedir” in the puppetmaster section of my `puppet.conf` to be the same as the path in my `fileserver.conf`. Then, in the manifests, I can just do this: content => template("$environment/path/file.erb"), -- Rob McBroom <http://www.skurfer.com/> It''s not that I think guns, drugs, prostitution, swimming, eating and reading should be legal. It''s just that no one on Earth has the authority to make them illegal. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.