[Puppet Users] Re: Puppet parameterized class - include for declaration?

2013-04-10 Thread Shantanu

On Tuesday, April 9, 2013 8:00:40 AM UTC-5, jcbollinger wrote:



 On Monday, April 8, 2013 4:10:03 PM UTC-5, Shantanu wrote:


 The parameterized classes guide mentions that a parameterized class is 
 declared using following syntax [1]:

 class {'classname': }


 But the puppetlabs postgresql 
 modulehttps://github.com/puppetlabs/puppet-postgresql#setupmentions that a 
 parameterized class '
 postgresql::serverhttps://github.com/puppetlabs/puppet-postgresql/blob/master/manifests/server.pp'
  
 can be declared using 'include' syntax [2]. 

 So is 'include' syntax supported for parameterized classes now?


 The 'include' function has always worked with parameterized classes.  It 
 just doesn't bind any parameter values to the named class.  Indeed, the 
 parameterized-style class declaration syntax is better viewed as a *parameter 
 binding* syntax, with a side effect of declaring the class.  That makes 
 it a lot easier to understand its constraints -- principally, that if a 
 parameterized-style class declaration is used, for a given class then it 
 must be the first declaration of that class that is evaluated. (Any number 
 of 'include' declarations may be used for the same class.)

 Using the 'include' function with parameterized classes makes especial 
 sense when relying exclusively on Puppet 3's automated hiera-based data 
 binding, because there is nothing but downside to using empty 
 parameterized-style class declarations.

 Note, too, that you can use (empty) parameterized declarations for 
 UNparameterized classes.  But don't do that.


 John



Thanks for explaining it John. I have always used empty parameterized 
declaration syntax. I had wrongly assumed that include won't work with it. 

--
Shantanu



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




[Puppet Users] Puppet parameterized class - include for declaration?

2013-04-08 Thread Shantanu

The parameterized classes guide mentions that a parameterized class is 
declared using following syntax [1]:

class {'classname': }


But the puppetlabs postgresql 
modulehttps://github.com/puppetlabs/puppet-postgresql#setupmentions that a 
parameterized class '
postgresql::serverhttps://github.com/puppetlabs/puppet-postgresql/blob/master/manifests/server.pp'
 
can be declared using 'include' syntax [2]. 

So is 'include' syntax supported for parameterized classes now?

--
Shantanu


1. http://docs.puppetlabs.com/guides/parameterized_classes.html
2. https://github.com/puppetlabs/puppet-postgresql#setup


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




[Puppet Users] puppetlabs code repositories and issues integration

2012-10-04 Thread Shantanu

I was wondering if it's possible to cross-reference a puppetlabs module 
code on github while creating an issue or discussion on puppetlabs projects 
site. It would be helpful if users could cross-reference code on the 
project site or puppetlabs github repositories have issues enabled.

Thanks,
Shantanu

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/JAvCqkZNXs4J.
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.



Re: [Puppet Users] puppetlabs code repositories and issues integration

2012-10-04 Thread Shantanu

Thanks for the reply Ryan. 

I am looking for an option that will help discuss code changes effectively 
by referencing a code snippet or a commit specific file revision in project 
issues. For example, here is an 
issuehttps://github.com/knowshan/puppetlabs-apache/issues/4opened in my 
forked puppetlabs-apache repository. Likewise, if someone 
wants to get feedback on proposed code changes, then it's helpful to put 
code snippets or commit ids within the issue discussion rather than 
pointing them to an external URL. Also, the github markup makes it easier 
to reference commit IDs and users. 

In addition, I think github issues will help in making issue assignment 
better as user accounts on both systems - issues and code repository - will 
be the same. I think this can be done by using github credentials on the 
project site as well.

Also, +1 for new updates to the forge site!
 
--
Regards,
Shantanu


On Thursday, October 4, 2012 10:28:51 AM UTC-5, Ryan Coleman wrote:

 Hi Shantanu, 

 I don't quite understand what you're asking for. Could you elaborate? 
 It sounds like you're looking for more than just pasting a URL into 
 the branch field of a ticket on our projects site. 

 I have been toying with the idea of enabling GitHub issues for some of 
 the Puppet Labs modules. Which module were you working on and what 
 would GitHub issues help you do better? 

 Cheers! 
 --Ryan 

 On Thu, Oct 4, 2012 at 7:57 AM, Shantanu knowsh...@gmail.comjavascript: 
 wrote: 
  
  I was wondering if it's possible to cross-reference a puppetlabs module 
 code 
  on github while creating an issue or discussion on puppetlabs projects 
 site. 
  It would be helpful if users could cross-reference code on the project 
 site 
  or puppetlabs github repositories have issues enabled. 
  
  Thanks, 
  Shantanu 
  
  -- 
  You received this message because you are subscribed to the Google 
 Groups 
  Puppet Users group. 
  To view this discussion on the web visit 
  https://groups.google.com/d/msg/puppet-users/-/JAvCqkZNXs4J. 
  To post to this group, send email to 
  puppet...@googlegroups.comjavascript:. 

  To unsubscribe from this group, send email to 
  puppet-users...@googlegroups.com javascript:. 
  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 view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/3ovg1bFMSZ8J.
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.



Re: [Puppet Users] Re: puppetlabs apache module syntax errors

2012-09-11 Thread Shantanu


On Monday, August 27, 2012 1:48:40 PM UTC-5, Ryan Coleman wrote:

 On Sun, Aug 26, 2012 at 6:22 PM, Shantanu knowsh...@gmail.comjavascript: 
 wrote: 
  Thanks for the reply Ryan. I haven't made any changes after cloning 
  this module (commit 66d5ce9ae). Following are contents of dav_fs 
  manifest file: 
  
  $ cat /etc/puppet/modules/apache/manifests/mod/dav_fs.pp 
  class apache::mod::dav_fs { 
Class[apache::mod::dav] - Class[apache::mod::dav_fs] 
apache::mod { 'dav_fs': } 
  } 

 Hi Shantanu, 

 I did manage to replicate this. I apologize for the inconvenience! 
 While this syntax works fine Puppet 2.7, we seem to have missed that 
 it breaks in 2.6. Thankfully, it's a quick fix. Just enclose the class 
 names in single quotes. We'll get this resolved for future users of 
 the apache module. 

 To fix, take this line: 
 Class[apache::mod::dav] - Class[apache::mod::dav_fs] 

 Replace it with this: 
 Class['apache::mod::dav'] - Class['apache::mod::dav_fs'] 

 Again, I'm sorry for the inconvenience! Thanks for letting us know about 
 this. 



Thank you for looking into the issue Ryan. 

Sorry for the late reply.

The syntax error got fixed by putting single quotes around class name while 
including the class. But, then I got following error:
{{{
Failed to apply catalog: Parameter name failed: Could not find resource 
type 'a2mod' at /etc/puppet/modules/apache/manifests/init.pp:65
}}}

I do have create_resources module installed on the server system. As a 
temporary workaround, I have removed mod_dir variable definition from 
params class to avoid a2mod resource call. I have verified that this error 
doesn't occur with Puppet 2.7 version. I am planning to use Puppet 2.7 for 
future tests. 

Also, I am not sure why a2mod is being called on a CentOS system. Isn't 
a2mod typically used by Debian variants?

--
Thanks,
Shantanu

-- 
You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/kSDeqVzuJjkJ.
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.



[Puppet Users] Re: puppetlabs apache module syntax errors

2012-08-26 Thread Shantanu


On Aug 24, 6:24 pm, Ryan Coleman r...@puppetlabs.com wrote:
 Hi Shantanu,

 On Fri, Aug 24, 2012 at 1:52 PM, Shantanu knowshant...@gmail.com wrote:

  I am getting following errors with the latest puppetlabs-apache
  module. I am using Puppet 2.6.16 on CentOS 6.2 OSs and with required
  dependency modules firewall (v0.0.4-80-g63fd433) and stdlib (3.0.0-27-
  g4e25230) installed in the modulepath.

 I'm sorry that you're hitting a problem with this module. Are you
 using the module from the Forge or are you using the code in
 development from GitHub?



  I have included only following class to in a node template:
  class{'apache': }

  When the catalog is being fetched for the first time then I get
  following error:
  {{{
  Could not retrieve catalog from remote server: Error 400 on SERVER:
  Syntax error at 'apache::mod::dav'; expected ']' at /etc/puppet/
  modules/apache/manifests/mod/dav_fs.pp:2

  }}}

 FWIW, I don't receive a parse failure like this when I apply just the
 apache class on a centos 6 machine using Puppet 2.6.16. Is it possible
 that the copy of the module you have has been modified in some way?
 Could you reply with the contents of
 /etc/puppet/modules/apache/manifests/mod/dav_fs.pp ?

Thanks for the reply Ryan. I haven't made any changes after cloning
this module (commit 66d5ce9ae). Following are contents of dav_fs
manifest file:

$ cat /etc/puppet/modules/apache/manifests/mod/dav_fs.pp
class apache::mod::dav_fs {
  Class[apache::mod::dav] - Class[apache::mod::dav_fs]
  apache::mod { 'dav_fs': }
}

Let me know if you need any additional details.

--
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.



[Puppet Users] puppetlabs apache module syntax errors

2012-08-24 Thread Shantanu

I am getting following errors with the latest puppetlabs-apache
module. I am using Puppet 2.6.16 on CentOS 6.2 OSs and with required
dependency modules firewall (v0.0.4-80-g63fd433) and stdlib (3.0.0-27-
g4e25230) installed in the modulepath.

I have included only following class to in a node template:
class{'apache': }


When the catalog is being fetched for the first time then I get
following error:
{{{
Could not retrieve catalog from remote server: Error 400 on SERVER:
Syntax error at 'apache::mod::dav'; expected ']' at /etc/puppet/
modules/apache/manifests/mod/dav_fs.pp:2

}}}

After restarting the concerned Puppet client I see a different error:
{{{
Could not retrieve catalog from remote server: Error 400 on SERVER:
Could not find class apache::mod::dav_fs in namespaces
apache::mod::default at /etc/puppet/modules/apache/manifests/mod/
default.pp:22
}}}

Am I missing any dependencies or do I need to configure any parameters
before using this module? Appreciate all the help.

--
Thanks,
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.



[Puppet Users] exec's onlyif parameter fails for a bash one-liner

2012-04-25 Thread Shantanu

I would like to 'exec' an installation script 'onlyif' an installation
directory is empty. I tried using following bash one-liner however it
didn't work:
code
  exec{$one_install_script:
require = File[$one_install_script],
onlyif = [ \$(/bin/ls -A  $one_location)\ ]  exit 1 || exit
0
  }

/code

It failed with following error:

error
err: Failed to apply catalog: Parameter onlyif failed: '[ $(/bin/ls -
A  /srv/cloud/one) ]  exit 1 || exit 0' is not qualified and no
path was specified. Please qualify the command or specify a path.
/error

A bash script with above one-liner worked fine though.
code
  exec{$one_install_script:
require = File[$one_install_script],
onlyif  = /tmp/is-dir-empty.sh $one_location
/code

The bash script approach works fine for me. However I am not sure what
is wrong with the one-liner command. Is $(cmd) command substitution or
built-in function 'exit' a problem?  Any pointers will be really
helpful.

--
Thanks,
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.



[Puppet Users] Re: exec's onlyif parameter fails for a bash one-liner

2012-04-25 Thread Shantanu


On Apr 25, 11:03 am, Florian Koch florian.koch1...@googlemail.com
wrote:
 Hi,

 you need to add provider = shell to your exec to get the subshell working

 regards Florian


Thanks Florian. The provider parameter took care of shell built-ins
and path as well.

--
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.



[Puppet Users] Re: exec's onlyif parameter fails for a bash one-liner

2012-04-25 Thread Shantanu

On Apr 25, 11:46 am, Craig Dunn cr...@craigdunn.org wrote:
 On 25/04/2012 17:01, Shantanu wrote:



  I would like to 'exec' an installation script 'onlyif' an installation
  directory is empty. I tried using following bash one-liner however it
  didn't work:
  code
     exec{$one_install_script:
       require =  File[$one_install_script],
       onlyif =  [ \$(/bin/ls -A  $one_location)\ ]  exit 1 || exit
  0
     }

 Puppet wont let you run commands that dont have fully qualified paths,
 try adding this and it should work...

 path = /bin


Almost worked, it didn't fail while applying the catalog however it
failed with following error.

{{{
Exec[/tmp/one_install_script]: Could not evaluate: Could not find
command '['
}}}

As suggested by Florian using 'provider = shell' takes care of PATH
and shell built-ins as well.

--
Thanks,
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.



[Puppet Users] Re: RSpec test to verify variable/parameter declaration

2012-04-24 Thread Shantanu

On Apr 23, 5:49 pm, Tim Sharpe t...@sharpe.id.au wrote:
 So, rspec-puppet can't and won't ever work this way.  What it's testing is 
 the resulting catalogue of Puppet resources that your host executes (the 
 behaviour of Puppet).  Instead of testing that a variable is defined, you 
 should be testing the resource(s) that those variables control/adjust.

 For example, if your variable changes the templated contents of a file 
 resource, then you should be testing the contents of that file resource.


Thanks for the details Tim. That's helpful.

--
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.



[Puppet Users] RSpec test to verify variable/parameter declaration

2012-04-23 Thread Shantanu

I have a module in which parameterized classes inherit regular (non-
parameterized) 'params' class. I am writing RSpec tests for this
module and would like to make sure that required variables have been
declared in the params class. Also, is it possible to write RSpec test
to make sure that these variables/parameters are accepted by the
required parameterized classes?  Any pointers will be really helpful.

--
Thanks,
Shantanu Pavgi

-- 
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.



[Puppet Users] Re: using array parameters with inherited parameterized classes

2012-04-13 Thread Shantanu
On Apr 13, 4:07 am, Craig Dunn cr...@craigdunn.org wrote:
  class depacks(
     $packages = $params::packages
  ) inherits params {

     package{ $packages:

 Putting quotes around $params::packages is making $packages a string
 rather than an array.  Remove the quotes and it should work



Thanks for pointing it out Craig. It's working now.

--
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.



[Puppet Users] using array parameters with inherited parameterized classes

2012-04-12 Thread Shantanu

I am trying to use an inherited  array parameter in a parameterized
class as follows:

puppet
class params{
  $packages = $operatingsystem ? {
Centos = ['scons','bzip2'],
Ubuntu = ['scons','bzip2'],
# Ubuntu = 'scons',
  }
}

class depacks(
  $packages = $params::packages
) inherits params {

  package{ $packages:
ensure = 'present',
  }
}

class {depacks: }
/puppet


* It's failing with following error:
error
err: /Stage[main]/Depacks/Package[sconsbzip2]/ensure: change from
purged to present failed: Execution of '/usr/bin/apt-get -q -y -o
DPkg::Options::=--force-confold install sconsbzip2' returned 100:
Reading package lists...
Building dependency tree...
Reading state information...
E: Couldn't find package sconsbzip2
/error

* It works fine if I override the inherited array parameter while
calling/evaluating the class:
puppet
class {depacks:
 packages = ['scons','bzip2'],
}
/puppet

I am using Puppet 2.6.14 with Ruby 1.8.7. The error occurs on both
Ubuntu and CentOS systems.

Am I missing something here? Any pointers will be really helpful.

--
Thanks,
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.



[Puppet Users] using stdlib module

2012-04-09 Thread Shantanu

I am trying to get stdlib installed and working as mentioned in the
module of the week blog post -
http://puppetlabs.com/blog/module-of-the-week-puppetlabsstdlib-puppet-labs-standard-library/
.

I ran following file_line test without noop mode. It created the
required file however it didn't agree to the fact that 'dan is
awesome' (created empty file).

{{{
$ puppet apply stdlib/tests/file_line.pp
notice: /Stage[main]//File[/tmp/dansfile]/ensure: created
notice: Finished catalog run in 0.02 seconds

$ cat /tmp/dansfile
$
}}}

I tried to use some of the functions in stdlib, e.g. validates_re,
however that resulted in 'Unknown function' error. So I am not sure if
this module is installed correctly. Following is the system
information:
 * CentOS release 6.2
 * ruby 1.8.7
 * facter 1.6.6
 * Puppet 2.6.14
 * stdlib was installed using puppet-module, however initially I had
manually  cloned stdlib git repository which didn't work as well.

Appreciate any help on how to debug this further.

--
Thanks,
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.



[Puppet Users] Re: using stdlib module

2012-04-09 Thread Shantanu


On Apr 9, 1:14 pm, Jeff McCune j...@puppetlabs.com wrote:
 On Mon, Apr 9, 2012 at 12:57 PM, harveyzh zh.jli...@gmail.com wrote:
  Shantanu:

  There is  a related thread - stdlib module not working - :

 Yes, I think the take away from that thread as it relates to this issue is
 to specify:

 file_line { '/tmp/dansfile':
   ensure = present,
   ...

 }

 The other issue you mentioned with functions appears to be an separate
 issue.  I believe Puppet 2.6 has problems loading functions from modules if
 you're using puppet apply instead of puppet agent with pluginsync.

 Please try Puppet 2.7 if you'd like to use puppet apply with stdlib in the
 modulepath.

 Hope this helps,
 -Jeff McCune


Thanks for the help - harveyzh and Jeff.

It's working fine after I added 'ensure = present' line to the
manifest.

The issue with functions is resolved as well. I had typos in couple of
function names that I had tried and hence it was returning 'unknown
function' error. It worked fine for me with 'puppet apply' as well.

--
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.



[Puppet Users] validate_re validation failures

2012-04-09 Thread Shantanu

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.

System information:
* CentOS release 6.2
* ruby 1.8.7
* facter 1.6.6
* Puppet 2.6.14

Am I missing something in the manifest? Any pointers will be really
helpful.

--
Thanks,
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.



[Puppet Users] Re: validate_re validation failures

2012-04-09 Thread Shantanu


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.

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?

--
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.



[Puppet Users] Re: validate_re validation failures

2012-04-09 Thread Shantanu


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?

--
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.



[Puppet Users] Re: validate_re validation failures

2012-04-09 Thread Shantanu

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.