Stefan Schulte | 1 Aug 01:07 2012
Picon

Re: [Puppet Users] Get extra error output when debugging custom types?

On Tue, Jul 31, 2012 at 03:24:15PM -0700, ZJE wrote:
> Is it possible to get extra output when running custom types? Right now, 
> I'm getting an error message and I'm not sure where in the code it's being 
> thrown from.
> For example, I can see that I'm trying to iterate over a null object, but 
> I'm not sure where in the code this happening when the message is this:
> ---
> Error: /Stage[main]//Node[testnode0101]/TestType[testname]: Could not 
> evaluate: undefined method `each' for nil:NilClass
> ---
> 

Try to run puppet with the --trace option which will hopefully show a
stacktrace when the error is happening. Otherwise you can place a few
method call like

    debug "inside validation block"

etc and run puppet with -d/--debug

-Stefan

--

-- 
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 <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Shannon McFarland | 1 Aug 01:22 2012
Picon

Re: [Puppet Users] $concat_basedir not defined

Here is the deal, we are trying to launch the puppet agent --test from the preseed file using this line:

d-i preseed/late_command string in-target puppet agent --test --waitforcert 0 || true; 

I tried using 'puppet agent --config=/etc/puppet/puppet.conf --test --waitforcert 0' given your suggestion but I don't think that it is a valid flag for the puppet agent (--config).

During the late_command run it gets a cert from the master just fine but then dies:

Jul 31 23:13:08 puppet-agent[5244]: Caching certificate for controller-1.example.com
Jul 31 23:13:08 in-target: ^[[0;32minfo: Caching certificate for controller-1.example.com^[[0m
Jul 31 23:13:09 puppet-agent[5244]: Caching certificate_revocation_list for ca
Jul 31 23:13:09 in-target: ^[[0;32minfo: Caching certificate_revocation_list for ca^[[0m
Jul 31 23:13:11 puppet-agent[5244]: Could not retrieve catalog from remote server: Error 400 on
SERVER: $concat_basedir not defined. Try running again with pluginsync enabled at /usr/share/pup
pet/modules/concat/manifests/setup.pp:25 on node controller
Jul 31 23:13:11 in-target: ^[[1;35merr: Could not retrieve catalog from remote server: Error 400
 on SERVER: $concat_basedir not defined. Try running again with pluginsync enabled at /usr/share
/puppet/modules/concat/manifests/setup.pp:25 on node control
Jul 31 23:13:11 puppet-agent[5244]: Not using cache on failed catalog
Jul 31 23:13:11 in-target: ^[[0;33mwarning: Not using cache on failed catalog^[[0m
Jul 31 23:13:11 puppet-agent[5244]: Could not retrieve catalog; skipping run
Jul 31 23:13:11 in-target: ^[[1;35merr: Could not retrieve catalog; skipping run^[[0m

Does the 'puppet agent' command support a path to the correct puppet.conf?  

Shannon

On Tuesday, July 31, 2012 1:52:59 PM UTC-6, R.I. Pienaar wrote:


----- Original Message -----
> From: "Shannon McFarland" <shmcfarl <at> gmail.com>
> To: puppet-users <at> googlegroups.com
> Sent: Tuesday, July 31, 2012 10:46:37 AM
> Subject: Re: [Puppet Users] $concat_basedir not defined
>
> Yeah, I ran it with 'sudo' and it pulled the plugin and kicked off.
> So, how can I point to the correct configuration without running as
> root or sudo in my preseed?

then you should edit whatever "puppet agent --configprint config"
reports as the right config file for the user else run puppet with
a specific --config=/etc/puppet/puppet.conf or similar

--
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/-/gJtyRr22APcJ.
To post to this group, send email to puppet-users <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Nick Lewis | 1 Aug 01:54 2012

[Puppet Users] Re: Access <at> resouce in custom type

On Tuesday, July 31, 2012 2:05:28 PM UTC-7, ZJE wrote:

Is it possible to access <at> resource variables inside a type?

I would like to make some decisions on parameters based on other parameters that may have already been set.

For example,
---
  newparam(:param1) do
    Puppet.debug "Found drivesperarray parameter"
    desc "parameter 1"
    validate do |value|
      if resource[:otherparam] then
        #dosomething
      else
        resource[:param1] = 0
      end
    end
    Puppet.debug "Parameter 1 is: #{ <at> resource[:param1]}"
  end
---

But I keep getting messages like "undefined method `[]' for nil:NilClass"

Anyone have experience with this? I've tried searching around for example without much luck...


It sounds like what you actually want is a munge block, which is used to change the value of the parameter.

munge do |value|
  if resource[:otherparam] then
    #dosomething
  else
    0
  end
end

validate should be used only to raise an exception if the value is invalid. Puppet will call validate and then munge. Also, parameters are set in the order they're defined in the type/<type>.rb file, and validated/munged before moving on to the next parameter. So a parameter can only depend on the values of parameters that come *before* it.
 
Thanks!

--
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/-/vNg7G08OxowJ.
To post to this group, send email to puppet-users <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar | 1 Aug 02:41 2012
Picon

Re: [Puppet Users] $concat_basedir not defined


----- Original Message -----
> From: "Shannon McFarland" <shmcfarl <at> gmail.com>
> To: puppet-users <at> googlegroups.com
> Sent: Tuesday, July 31, 2012 4:22:31 PM
> Subject: Re: [Puppet Users] $concat_basedir not defined
> 
> Here is the deal, we are trying to launch the puppet agent --test
> from the preseed file using this line:
> d-i preseed/late_command string in-target puppet agent --test
> --waitforcert 0 || true;
> 
> 
> I tried using 'puppet agent --config=/etc/puppet/puppet.conf --test
> --waitforcert 0' given your suggestion but I don't think that it is
> a valid flag for the puppet agent (--config).
> 
> 
> During the late_command run it gets a cert from the master just fine
> but then dies:
> 
> 
> 
> Jul 31 23:13:08 puppet-agent[5244]: Caching certificate for
> controller-1.example.com
> Jul 31 23:13:08 in-target: ^[[0;32minfo: Caching certificate for
> controller-1.example.com^[[0m
> Jul 31 23:13:09 puppet-agent[5244]: Caching
> certificate_revocation_list for ca
> Jul 31 23:13:09 in-target: ^[[0;32minfo: Caching
> certificate_revocation_list for ca^[[0m
> Jul 31 23:13:11 puppet-agent[5244]: Could not retrieve catalog from
> remote server: Error 400 on
> SERVER: $concat_basedir not defined. Try running again with
> pluginsync enabled at /usr/share/pup
> pet/modules/concat/manifests/setup.pp:25 on node controller
> Jul 31 23:13:11 in-target: ^[[1;35merr: Could not retrieve catalog
> from remote server: Error 400
> on SERVER: $concat_basedir not defined. Try running again with
> pluginsync enabled at /usr/share
> /puppet/modules/concat/manifests/setup.pp:25 on node control
> Jul 31 23:13:11 puppet-agent[5244]: Not using cache on failed catalog
> Jul 31 23:13:11 in-target: ^[[0;33mwarning: Not using cache on failed
> catalog^[[0m
> Jul 31 23:13:11 puppet-agent[5244]: Could not retrieve catalog;
> skipping run
> Jul 31 23:13:11 in-target: ^[[1;35merr: Could not retrieve catalog;
> skipping run^[[0m
> 
> 
> Does the 'puppet agent' command support a path to the correct
> puppet.conf?

it does, are you certain it has pluginsync=true in the config 
file at that time? 

you can also just do --pluginsync on the command line

--

-- 
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 <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Ramin K | 1 Aug 02:45 2012
Picon

Re: [Puppet Users] Re: High CPU load / queued passenger requests

On 7/31/2012 2:17 PM, Luke Baker wrote:
> I ended up restart the mysql database on the storeconfigs server which
> helped this problem dramatically. But, I'm still open for more tuning
> options if they're out there : )
>
>     Some info:
>     Puppetmaster is RHEL6 x86_64 (VM)
>     4 vCPU 8GB memory
>     Apache 2.2
>     Passenger 3.0.7
>

PassengerHighPerformance on
PassengerMaxPoolSize 8
PassengerMinInstances 1
PassengerMaxRequests 10000
PassengerStatThrottleRate 120
PassengerPreStart https://puppet.mydomain.com:8140/

In Passenger 3.0.x GlobalQueue is on by default so you can drop that.

MinInstances is new in 3.0.x. Using it obviates the need for timeout 
settings. Setting MinInstances beyond 1 unless done at the vhost level 
for specific reasons is a bad idea because Passenger can balance 
application instances better than you. Keep in mind that MinInstances 
does not start applications when your http daemon starts for the first 
time.

PassengerPreStart does start applications when the server restarts and 
takes a URL as an argument which it uses in the host headers when it 
connects to localhost. This should also be applied at the vhost level.

MaxRequests can be reasonably high with a mature app like Puppet.

MaxPoolSize is a little harder to size. A Puppet master is usually CPU 
bound and I default to (cores * 2), but it depends on your apps. I'd aim 
for 80% of CPU with all Rack processes in use and add or drop from the 
poolsize to achieve it. Keep in mind that a Puppet Rack process will 
weigh in around 150-200MB and you should have enough RAM to support the 
max pool size.

Rails/Rack autodetect shouldn't be needed with a normal vhost for Puppet.

I would not touch the Passenger spawn method at all unless there is a 
specific reason to modify it. There is not a reason to modify it with 
Puppet in my opinion.
http://www.modrails.com/documentation/Users%20guide%20Apache.html#spawning_methods_explained

Ramin

--

-- 
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 <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Joe Topjian | 1 Aug 03:41 2012
Picon

[Puppet Users] duplicate resources across defined types

Hello,


I am hoping that someone might be able to shed some light on the best way to solve an issue.


This commit introduced functionality into the vhost type to ensure that the $docroot and $logroot exist. This is smart as Apache will throw a warning if $docroot does not exist and error out if $logroot does not exist.

I believe the original intention of the author was to make the names of these resources unique so that multiple vhosts can share the same docroot and logroot (line 71-80). However, the path of the resources is not unique across vhosts that use the same $docroot and $logroot and therefore puppet will error out.

The first thing that came to my mind was to make the resources virtual and then just realize a single directory. Unless something special needs done, marking the two file resources as virtual ( <at> file) still does not work.

The other option that has been discussed is to use a conditional if block:


Here, on all but one of the vhost entries, you mark ensure_dirs as false and Puppet will not enforce the existence of the two directories. This works, but it comes off as a workaround more than a proper solution.

Any ideas?

Thanks,
Joe



--
Joe Topjian
Systems Administrator
Cybera Inc.


Cybera is a not-for-profit organization that works to spur and support innovation, for the economic benefit of Alberta, through the use of cyberinfrastructure.

--
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 <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Axel Bock | 1 Aug 08:16 2012
Picon

Re: [Puppet Users] Using file{} with array parameter fails

thanks for the reply, I actually made an error in my declaration. I used two variables which I had just moved out of scope, and so I declared two empty File[] objects - and puppet complained.

When your solution didn't work either it hit me :) .

thanks & greetings!
Axel.



Am Dienstag, 31. Juli 2012 16:10:23 UTC+2 schrieb David Schmitt:

Hi Axel,


   $filesA = ["/tmp/A1", "/tmp/A2", "/tmp/A3" ]
   $filesB = ["/tmp/B1", "/tmp/B2", "/tmp/B3" ]

   file {
     $filesA:
       ensure => present,
       mode => 0644, owner => root;
     $filesB:
       ensure => present,
       mode => 0755, owner => "www-data";
   }

If you're looking for something different you might want to look into
setting recurse=>true. Read the Type Reference for more info.

Best Regards, David

--
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/-/hgdnKnvvHGcJ.
To post to this group, send email to puppet-users <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Axel Bock | 1 Aug 08:18 2012
Picon

Re: [Puppet Users] NFS mounts with puppet creates error

Hello Christopher,

that's a nice explanation. I thought only the contents _under_ .../nfs-mounted/ would be server-side, not the mount-point itself. Well you always learn more. no_root_squash is not an option, I will have a look as how to manage that properly on our server side.

Mainly I just want to have the directory to have the correct permission when it is not currently mounted.


Thanks & greetings,
Axel.

Am Mittwoch, 1. August 2012 00:24:21 UTC+2 schrieb Christopher Wood:

(inline)

On Tue, Jul 31, 2012 at 05:23:00AM -0700, Axel Bock wrote:
>    Hi group,
>
>    I am managing an NFS mount with puppet. And it does not work, and
>    seriously I really don't see how this can work out nicely. First I make
>    sure with a file {} class that the directory I want to mount exists. Cause
>    it is used by the webserver it should belong to the wwwrun/www group on
>    the system. No prob.

This is changing the directory inode on the nfs client.

>    Then I mount the NFS share on the dir. No prob.

Now the inode that your nfs client sees is on the nfs server. It is not the same inode that you just managed with puppet.

(I say inode, but depending on the nfs server it may not be a unix filesystem behind it.)

>    On the 2nd run of puppet though ... Error! The NFS mount point is
>    "changed" over to root:root with 775 permissions (or 777? I don't
>    remember). Puppet of course now wants to set the user:group of the dir ...
>    and naturally fails.

This is dependent on your nfs server settings. You likely have root_squash set by default (see 'man exportfs'), so any activity as the root user on the nfs client is mapped to a "nobody" or "nfsnobody" (uid 65535 or similar) on the nfs server. Check /etc/exports on the nfs server.

>    So is there a way to keep this error from happening?

You can set no_root_squash on the export and run 'exportfs -a' on the nfs server. Then you might have to remount on the client end.

The broader issue is whether you should manage file permissions on the nfs client or the nfs server. I haven't decided myself, but if you do it on the server you won't have to reduce security by running no_root_squash. The mount will also arrive with the correct permissions.

>    Thanks in advance & greetings,
>    Axel.
>
>    --
>    You received this message because you are subscribed to the Google Groups
>    "Puppet Users" group.
>    To view this discussion on the web visit
>    [1]https://groups.google.com/d/msg/puppet-users/-/tw1oa58dRhoJ.
>    To post to this group, send email to puppet-users <at> googlegroups.com.
>    To unsubscribe from this group, send email to
>    puppet-users+unsubscribe <at> googlegroups.com.
>    For more options, visit this group at
>    http://groups.google.com/group/puppet-users?hl=en.
>
> References
>
>    Visible links
>    1. https://groups.google.com/d/msg/puppet-users/-/tw1oa58dRhoJ

--
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/-/Zv1eyP-mRrQJ.
To post to this group, send email to puppet-users <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rakesh K | 1 Aug 08:53 2012
Picon

[Puppet Users] Issues with installing some modules !!!

Hi,

I am new to puppet and have started evaluating various features in last few days. I am not a developer and am mostly going to use the modules available on github or puppet forge.

Currently I have tried all easier modules and they seem to work perfectly without any issues, but now the problem is arising when I am trying to use modules like mysql, tomcat etc...

For mysql I am using the module https://github.com/puppetlabs/puppetlabs-mysql

What I am observing is mysql is gets installed and everything but no db is added, also intermittently the password is not set, it is neither not blank nor does it set the password that I have mentioned. The nodes.pp that I am using is as follows

[root <at> pmast1 manifests]# cat /etc/puppet/manifests/nodes.pp
class baseclass {
class { 'mysql': }
class { 'mysql::server':
#config_hash => { 'root_password' => 'mypass' }
}
mysql::db { 'mydb':
user     => 'myuser',
password => 'mypass',
host     => 'localhost',
grant    => ['all'],
}
}

node 'pclient1.example.com' {
        include baseclass
}

Now as in nodes.pp if I try to set the password it gives me the error below on the puppet client node

[root <at> pclient1 ~]# puppetd --test
notice: Ignoring --listen on onetime run
info: Caching catalog for pclient1.example.com
info: Applying configuration version '1343801984'
notice: /Stage[main]/Mysql::Config/

Exec[set_mysql_rootpw]/returns: mysqladmin: connect to server at 'localhost' failed
notice: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]/returns: error: 'Access denied for user 'root' <at> 'localhost' (using password: NO)'
err: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]/returns: change from notrun to 0 failed: mysqladmin -u root  password mypass returned 1 instead of one of [0] at /etc/puppet/modules/mysql/manifests/config.pp:94
notice: /File[/root/.my.cnf]: Dependency Exec[set_mysql_rootpw] has failures: true
warning: /File[/root/.my.cnf]: Skipping because of failed dependencies
notice: /Stage[main]/Mysql::Config/Exec[mysqld-restart]: Dependency Exec[set_mysql_rootpw] has failures: true
warning: /Stage[main]/Mysql::Config/Exec[mysqld-restart]: Skipping because of failed dependencies
notice: Finished catalog run in 0.56 seconds


And in case I do not specify the password in the nodes.pp, not sure what password is sets but only adds the mysql service to the client node.

I am sure I am missing something and here but not sure what...

Also in case of tomcat I am having similar issues not sure how can I add applications or tomcat in the /usr/local/tomcat path.

Thanks for your help in advance.

Rakesh K.

--
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/-/cmCymGkqgf4J.
To post to this group, send email to puppet-users <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rakesh Kathpal | 1 Aug 08:50 2012
Picon

[Puppet Users] Issues with some modules !!!

Hi,

I am new to puppet and have started evaluating various features in last few days. I am not a developer and am mostly going to use the modules available on github or puppet forge.

Currently I have tried all easier modules and they seem to work perfectly without any issues, but now the problem is arising when I am trying to use modules like mysql, tomcat etc...

For mysql I am using the module https://github.com/puppetlabs/puppetlabs-mysql

What I am observing is mysql is gets installed and everything but no db is added, also intermittently the password is not set, it is neither not blank nor does it set the password that I have mentioned. The nodes.pp that I am using is as follows

[root <at> pmast1 manifests]# cat /etc/puppet/manifests/nodes.pp
class baseclass {
class { 'mysql': }
class { 'mysql::server':
#config_hash => { 'root_password' => 'mypass' }
}
mysql::db { 'mydb':
user     => 'myuser',
password => 'mypass',
host     => 'localhost',
grant    => ['all'],
}
}

node 'pclient1.example.com' {
        include baseclass
}

Now as in nodes.pp if I try to set the password it gives me the error below on the puppet client node

[root <at> pclient1 ~]# puppetd --test
notice: Ignoring --listen on onetime run
info: Caching catalog for pclient1.example.com
info: Applying configuration version '1343801984'
notice: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]/returns: mysqladmin: connect to server at 'localhost' failed
notice: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]/returns: error: 'Access denied for user 'root' <at> 'localhost' (using password: NO)'
err: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]/returns: change from notrun to 0 failed: mysqladmin -u root  password mypass returned 1 instead of one of [0] at /etc/puppet/modules/mysql/manifests/config.pp:94
notice: /File[/root/.my.cnf]: Dependency Exec[set_mysql_rootpw] has failures: true
warning: /File[/root/.my.cnf]: Skipping because of failed dependencies
notice: /Stage[main]/Mysql::Config/Exec[mysqld-restart]: Dependency Exec[set_mysql_rootpw] has failures: true
warning: /Stage[main]/Mysql::Config/Exec[mysqld-restart]: Skipping because of failed dependencies
notice: Finished catalog run in 0.56 seconds


And in case I do not specify the password in the nodes.pp, not sure what password is sets but only adds the mysql service to the client node.

I am sure I am missing something and here but not sure what...

Also in case of tomcat I am having similar issues not sure how can I add applications or tomcat in the /usr/local/tomcat path.

Thanks for your help in advance.

Rakesh K.




--
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 <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Gmane