On Apr 9, 5:37 pm, Jeff McCune <j...@puppetlabs.com> wrote:
> On Mon, Apr 9, 2012 at 3:23 PM, Shantanu <knowshant...@gmail.com> wrote:
>
> > On Apr 9, 4:43 pm, Jeff McCune <j...@puppetlabs.com> wrote:
> > > On Mon, Apr 9, 2012 at 2:40 PM, Shantanu <knowshant...@gmail.com> wrote:
>
> > > > On Apr 9, 4:06 pm, Jeff McCune <j...@puppetlabs.com> wrote:
> > > > > On Mon, Apr 9, 2012 at 4:45 PM, Shantanu <knowshant...@gmail.com>
> > wrote:
>
> > > > > > I am using stdlib module's validate_re function to validate
> > parameters
> > > > > > passed to a parameterized class as pasted here:
> > > > > >http://pastebin.com/7eYAeLEa
> > > > > > .
>
> > > > > > The validation works fine however when I run this manifest locally
> > > > > > using 'puppet apply' command where puppet execution stops if a
> > > > > > validation test fails. However when I use it in client-server model
> > > > > > then I do see a validation match failure error but rest of the
> > puppet
> > > > > > manifest application (file creation) proceeds fine instead of
> > > > > > failing.
>
> > > > > validate_re will abort the catalog compilation process entirely.
> >  Are you
> > > > > sure your puppet agent is not falling back to using a previously
> > cached
> > > > > copy of the catalog?
>
> > > > > If you use puppet agent --test it will disable the "use cache on
> > failure"
> > > > > feature of Puppet.
>
> > > > > -Jeff
>
> > > > Thanks Jeff. That was the issue. The pastebin logs do indicate 'using
> > > > cached catalog' message.
>
> > > > I am manually starting/stopping puppetd for these tests. I started it
> > > > again without '--test' option but this time it couldn't retrieve
> > > > (cached) catalog. It failed (or rather skipped catalog run) with
> > > > following messages:
>
> > > > {{{
> > > > Apr  9 16:15:11 one-23 puppet-agent[24242]: Could not retrieve catalog
> > > > from remote server: Error 400 on SERVER: validate_re(): "mysq" does
> > > > not match ["mysql", "sqlite"] at /etc/puppet/manifests/classes/
> > > > teststdlib.pp:5 on node one-23...
> > > > Apr  9 16:15:11 one-23 puppet-agent[24242]: Using cached catalog
> > > > Apr  9 16:15:11 one-23 puppet-agent[24242]: Could not retrieve
> > > > catalog; skipping run
> > > > }}}
>
> > > > If I use '--test' option then I get 'error 400' immediately and
> > > > puppetd doesn't get started as well.
>
> > > This all sounds like Puppet is behaving exactly as I expect it to.
>
> > > > Since it once worked for me even without '--test' option I am
> > > > wondering how long does a node keep cache? Is cache dependent on any
> > > > factors other than time interval?
>
> > > Puppet caches the last "good" (compiled) catalog it received from the
> > > master indefinitely.  The purpose is that if you have a syntax error in
> > > your manifests, Puppet will still manage the system using the last known
> > > good catalog.
>
> > > Once the syntax error is fixed, the new catalog will replace the old
> > > catalog in the agent's cache.
>
> > > -Jeff
>
> > Thanks for the explanation Jeff.
>
> > If Puppet caches a catalog indefinitely then I am not sure why it
> > failed once as indicated in my previous email.
>
> > {{{
> > Apr  9 16:15:11 one-23 puppet-agent[24242]: Could not retrieve
> > catalog
> > from remote server: Error 400 on SERVER: validate_re(): "mysq" does
> > not match ["mysql", "sqlite"] at /etc/puppet/manifests/classes/
> > teststdlib.pp:5 on node one-23...
> > Apr  9 16:15:11 one-23 puppet-agent[24242]: Using cached catalog
> > Apr  9 16:15:11 one-23 puppet-agent[24242]: Could not retrieve
> > catalog; skipping run
> > }}}
>
> > It seems like here it couldn't get remote catalog because of
> > validation failure. And later it tried to use cached catalog but
> > failed to retrieve it as well. It didn't happen for previous runs as
> > it successfully applied cached catalog. Am I missing any details
> > here?
>
> It appears you have a typo in your manifest.  You've written mysq (no
> trailing lower case L) but the module expects "mysql" or "sqlite"
>
> This is why you're seeing the failure.
>
> -Jeff


This failure or rather input validation was intentional. I was testing
validate_re function usage to fail if a bad/unsupported parameter
value was passed. However initially I was seeing successful catalog
application even after getting Error 400 from the puppet master.  As
you correctly pointed out this was an issue with cached catalog.

Later I started puppetd again, still without '--test' option, and I
didn't see the same behavior.  As mentioned in earlier replies puppet
agent not only failed to retrieve catalog from the pupet master but it
also failed to apply/retrieve cached catalog. So I was wondering if
this caching is related to some time interval or if something else
triggered cached catalog to be discarded.

--
Shantanu

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to