[Puppet Users] define function problem

2012-04-06 Thread sam
Hi All,

Hope you people are doing good.

I have a manifest file :

lass profile {
# setup profile parms. We dont handle non Ubuntu OS yet
if ($operatingsystem == Ubuntu) {
file {
/etc/profile.d:
ensure  = directory,
purge   = true,
force   = true,
recurse = true,
owner   = root,
group   = root,
mode= 644;
}
}
}
class profile::ulimit inherits profile {
if ($operatingsystem == Ubuntu) {
define set_ulimit($limit=null) {
file {
/etc/profile.d/ulimit.sh:
ensure  = file,
mode= 644,
owner   = root,
group   = root,
content = template('profile/ulimit.sh.erb');
}
}

set_ulimit { ulimit.sh: limit  = $((2 * 1073741824)); }
}
}
class profile::ulimit::full inherits profile::ulimit {
if ($operatingsystem == Ubuntu) {
if defined(Set_ulimit[ulimit.sh]) {
Set_ulimit[ulimit.sh] {
limit  = unlimited #unlimited
}
}
}
}

when i run puppet parser validate it gives me error :

err: Could not parse for environment production: Classes, definitions,
and nodes may only appear at toplevel or inside other classes;
expected '%s' at
/home/vgsuresh/svn/operations/puppet/modules/profile/manifests/init.pp:19
err: Try 'puppet help parser validate' for usage


-- 
Best Regards,
Suresh Kumar Prajapati
Operations Engineer | Inmobi India
E-mail: er.sureshprajap...@gmail.com
Mob No: +91-9611708308

Theory is when you know all and nothing works. Practice is when all
works and nobody knows why. In this case we have put together theory
and practice: nothing works... and nobody knows why!

-- 
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: Getting started

2012-04-06 Thread jcbollinger


On Apr 5, 4:14 pm, Jo Rhett jrh...@netconsonance.com wrote:
 [...] But you should probably be using the docs onwww.puppetlabs.comrather 
 than the PDF, I suspect they are kept more up to date.


There's a PDF?  :)


John

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



Re: [Puppet Users] Re: Getting started

2012-04-06 Thread Dan White
http://info.puppetlabs.com/download-pdfs.html

“Sometimes I think the surest sign that intelligent life exists elsewhere in 
the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin  Hobbes)

- jcbollinger john.bollin...@stjude.org wrote:
 
 
 On Apr 5, 4:14 pm, Jo Rhett jrh...@netconsonance.com wrote:
  [...] But you should probably be using the docs onwww.puppetlabs.comrather 
  than the PDF, I suspect they are kept more up to date.
 
 
 There's a PDF?  :)
 
 
 John
 
 -- 
 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.
 

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



Re: [Puppet Users] Getting started

2012-04-06 Thread Andreas Haerter
Hi,

On 05.04.2012 22:42, Brown, Rodrick wrote:
 I really hate poor documentation.
 
 I’m following along in PDF documentation I downloaded from the official
 site and I’m stuck after I installed rack  passenger modules from
 rubygems.

There is a PDF?! OK...

However, Maybe helpful:
http://blog.andreas-haerter.com/2012/02/05/how-to-start-puppet-system-config-links-resources-tutorials
- How to start listing


 I ran the passenger build script and it compiled and installed into my
 local apache httpd server successfully.

I personally started by using Puppet without master but puppet apply
instead. I created modules and then ran something like

 su -
 puppet apply --verbose --modulepath /your/modules-directory/ -e class { 
 'example': } foobar { [...] }

to learn the stuff before creating master infrastructure and stuff.
BTW: There are masterless users out there (cf. Masterless listing at
my blog posting linked above).


 Puppet seems way too clumber some with the amount of dependencies
 required so far.

Seriously: use the packages of your distribution or the YUM/APT repos by
Puppetlabs if you want to start with all the 2.7 features right now (I
would recommend that - why learning and maintain old stuff if you just
start to use Puppet?). Or are you running Puppet on windows (=no
repositories available)?

-- 
Andreas http://blog.andreas-haerter.com

O ascii ribbon campaign - stop html mail - www.asciiribbon.org



signature.asc
Description: OpenPGP digital signature


[Puppet Users] Re: define function problem

2012-04-06 Thread jcbollinger


On Apr 6, 1:07 am, sam er.sureshprajap...@gmail.com wrote:
 Hi All,

 Hope you people are doing good.

 I have a manifest file :

 lass profile {


That's supposed to be class of course.  I guess it's a cut  paste
error.

Anyway, this class (and all of your others) really ought to be in a
module.


 # setup profile parms. We dont handle non Ubuntu OS yet
     if ($operatingsystem == Ubuntu) {
         file {
             /etc/profile.d:
                 ensure  = directory,
                 purge   = true,
                 force   = true,
                 recurse = true,
                 owner   = root,
                 group   = root,
                 mode    = 644;
         }
     }}

 class profile::ulimit inherits profile {


This class really oughtn't to inherit from class profile.  Puppet
class inheritance is only appropriate where the subclass overrides one
or more properties of one of its superclass's resources (if even
then).  In all other cases, including this one, you should use
composition instead:

include 'profile'


     if ($operatingsystem == Ubuntu) {
         define set_ulimit($limit=null) {
                 file {
                     /etc/profile.d/ulimit.sh:
                         ensure  = file,
                         mode    = 644,
                         owner   = root,
                         group   = root,
                         content = template('profile/ulimit.sh.erb');
                     }
         }

         set_ulimit { ulimit.sh: limit  = $((2 * 1073741824)); }
     }}

 class profile::ulimit::full inherits profile::ulimit {
     if ($operatingsystem == Ubuntu) {
         if defined(Set_ulimit[ulimit.sh]) {
             Set_ulimit[ulimit.sh] {
                 limit  = unlimited #unlimited
             }
         }
     }

 }

 when i run puppet parser validate it gives me error :

 err: Could not parse for environment production: Classes, definitions,
 and nodes may only appear at toplevel or inside other classes;
 expected '%s' at
 /home/vgsuresh/svn/operations/puppet/modules/profile/manifests/init.pp:19
 err: Try 'puppet help parser validate' for usage


Your definition set_ulimit can only appear at top level or
(directly) inside a class.  It cannot appear inside a conditional
statement, and you don't need it to do.  Just move the definition
outside the conditional.  It makes no difference to declare it
unconditionally if you only declare instances conditionally.  As a
matter of style, though, it should appear at top level (but in a
module) instead of inside a class.

Furthermore, your naming and manifest design suggest a fundamental
misunderstanding: definitions should not be construed as functions or
(especially) macros.  Rather, they define *resource types*, analogous
to Puppet's built-in resource types in almost every way.  You are
likely to have continual trouble with definitions until you adjust
your mental model.

Note also:

1) Although the 'defined' function can be used to determine whether a
particular resource has been declared, that's poor practice.  If your
manifest structure does not pre-determine the answer (which in your
case it does) then the answer is parse-order dependent (which will
bite you eventually).

2) Since your manifest structure already controls whether resource
Set_ulimit[ulimit.sh] will have been declared by the time your class
profile::ulimit::full is parsed (it is declared by the superclass),
you don't need to test for it via 'defined':

class profile::ulimit::full inherits profile::ulimit {
if ($operatingsystem == Ubuntu) {
Set_ulimit[ulimit.sh] {
limit  = unlimited #unlimited
}
}
}

3) Really, the whole approach is awkward.  It would be much better to
build this around a *data* hierarchy (via Hiera) than around a class
hierarchy.  You could merge 'set_ulimit' into class profile::ulimit
and get rid of class profile::ulimit::full altogether.  With a bit
more work you could even get rid of the conditional statements, or at
least convert them to be generic instead of OS-specific.


John

-- 
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] freebsd provider keeps reinstalling packages?

2012-04-06 Thread Christopher Wood
Question: how do I get puppet 2.7.6 on FreeBSD 9.0-RELEASE to stop downloading 
packages with every puppet run?

Obviously I'd be puppetizing the config files so this wouldn't be a huge big 
deal, but a daemon restart after every puppet run due to notify/subscribe 
involving the config file isn't optimal.

My simple manifest is this:

package { 'ntp-4.2.6p5/net/ntp':
  ensure = installed,
  provider = 'freebsd',
}

It does indeed install ntp:

[root@cwlab-01 /var/db/pkg]# /usr/sbin/pkg_info -aoQ | grep ntp
ntp-4.2.6p5:net/ntp

But every single time I run puppet apply --debug --verbose /tmp/ntp.pp, I get 
the following, indicating that the package is reinstalled:

debug: Puppet::Type::Package::ProviderFreebsd: Executing '/usr/sbin/pkg_info 
-aoQ'
debug: Package: ntp-4.2.6p5/net/ntp: origin = {:port_category=net, 
:port_name=ntp}
debug: Package: ntp-4.2.6p5/net/ntp: source = #URI::FTP:0x807f1f518 
URL:ftp://ftp.freebsd.org/%2Fpub/FreeBSD/ports/amd64/packages-9-stable/
debug: Fetching INDEX: #URI::FTP:0x807f1abf8 
URL:ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/INDEX.bz2
debug: Package: ntp-4.2.6p5/net/ntp: package_uri = #URI::FTP:0x80b32c838 
URL:ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/All/ntp-4.2.6p5.tbz
debug: Puppet::Type::Package::ProviderFreebsd: Executing '/usr/sbin/pkg_add -f 
ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-stable/All/ntp-4.2.6p5.tbz'
notice: /Stage[main]//Package[ntp-4.2.6p5/net/ntp]/ensure: created


I get the same behaviour with other package names:

ntp-4.2.6p5:/net/ntp
*/net/ntp

-- 
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: Somehow puppet is not able to start ossec service

2012-04-06 Thread jcbollinger


On Apr 5, 6:43 am, ankush grover ankushcen...@gmail.com wrote:
 Hi Friends,

 I have configured Puppet 2.7.12-1 on Centos 6 as server and various clients
 running on Redhat/Centos/Ubuntu etc.. The  issue I am facing is that
 somehow Puppet is not able to start the ossec service on the client.

 If the service is stopped on the client then puppet is not able to start
 the service. Below are the logs of the Puppet client running on the Centos
 5 machine.


From the log, it does not appear that Puppet is unable to start the
service, but rather that it thinks it doesn't needs to do.  The log
shows it checking the service's current status

 debug: Service[ossec](provider=redhat): Executing '/sbin/service ossec
 status'

and whether the service is enabled

 debug: Puppet::Type::Service::ProviderRedhat: Executing '/sbin/chkconfig
 ossec'

but not any attempt to start the service.  There are two main
possibilities:

1) Your manifest doesn't declare that the service should be running,
or

2) the service's initscript does not follow LSB convention for the
return value of the 'status' command.  Puppet relies on the return
value, not the text output.  See, for example,
http://refspecs.linux-foundation.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html.

My bet would be that the initscript's 'status' command is always
returning 0, regardless of the actual status. Instead, it ought to
return 1, 2, or 3 when the service is not running, depending on
whether there is a leftover pid file, lock file, or neither.


John

-- 
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: hiera_array() default value not taken

2012-04-06 Thread Jason Koppe
I have this problem too.  Do defaults work for anyone?

On Apr 2, 7:03 am, Pablo Fernandez pablo.fernan...@cscs.ch wrote:
 Hi,

 There is probably something stupid I am missing, but I just can't see
 it. I do:

 $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', [])

 And I have not defined that in the hiera tree, so the default (an empty
 array) should be returned. But I get, instead:

 Error 400 on SERVER: Could not find data item
 iptables_open_ports_public in any Hiera data file and no default supplied

 Is there any special way to define an empty array as a parameter?

 Thanks!
 Pablo

-- 
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: hiera_array() default value not taken

2012-04-06 Thread Jason Koppe
I'm using the YAML backend.  Not sure if that's going to matter.

On Apr 6, 11:07 am, Jason Koppe jason.robert.ko...@gmail.com wrote:
 I have this problem too.  Do defaults work for anyone?

 On Apr 2, 7:03 am, Pablo Fernandez pablo.fernan...@cscs.ch wrote:







  Hi,

  There is probably something stupid I am missing, but I just can't see
  it. I do:

  $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', [])

  And I have not defined that in the hiera tree, so the default (an empty
  array) should be returned. But I get, instead:

  Error 400 on SERVER: Could not find data item
  iptables_open_ports_public in any Hiera data file and no default supplied

  Is there any special way to define an empty array as a parameter?

  Thanks!
  Pablo

-- 
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: hiera_array() default value not taken

2012-04-06 Thread Hunter Haugen
Looks like a default of [] 
triggers 
https://github.com/puppetlabs/hiera-puppet/blob/master/lib/puppet/parser/functions/hiera_array.rb#L32
 
to think that the `.lookup` function did not get an answer.

Hiera and Hiera-puppet have to distinguish between empty/false/nil answers 
sent by the backend due to missing data, or empty/false/nil answers 
explicitly returned as the default value or found value. Having hiera just 
return an empty answer when an answer is not found would probably not be 
preferable, so nil could possibly be the not found value?

-Hunter

On Monday, April 2, 2012 5:03:37 AM UTC-7, pablo.f...@cscs.ch wrote:

 Hi,

 There is probably something stupid I am missing, but I just can't see 
 it. I do:

 $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', 
 [])

 And I have not defined that in the hiera tree, so the default (an empty 
 array) should be returned. But I get, instead:

 Error 400 on SERVER: Could not find data item 
 iptables_open_ports_public in any Hiera data file and no default supplied

 Is there any special way to define an empty array as a parameter?

 Thanks!
 Pablo



-- 
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/-/qiLhtq9pEX8J.
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: hiera_array() default value not taken

2012-04-06 Thread psychobyte
I don't think hiera likes defaults as array/hashes explicitly

I usually do a 

$empty_hsh = {}
$empty_arr = []

and use those as default values.

HTH


On Monday, April 2, 2012 5:03:37 AM UTC-7, pablo.f...@cscs.ch wrote:

 Hi,

 There is probably something stupid I am missing, but I just can't see 
 it. I do:

 $iptables_open_ports_public = hiera_array ('iptables_open_ports_public', 
 [])

 And I have not defined that in the hiera tree, so the default (an empty 
 array) should be returned. But I get, instead:

 Error 400 on SERVER: Could not find data item 
 iptables_open_ports_public in any Hiera data file and no default supplied

 Is there any special way to define an empty array as a parameter?

 Thanks!
 Pablo



-- 
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/-/r9CJ90mbMVgJ.
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] configuration version variable?

2012-04-06 Thread psychobyte
Hi,

is there a fact or variable for the configuration version that I can access 
from hiera or my manifests? I'd like to embed it into my files.

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/-/y9V2HDKg-YQJ.
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] configuration version variable?

2012-04-06 Thread Patrick Debois
I've implemented that - See pull request - 
https://github.com/puppetlabs/hiera-puppet/pull/20


See 
https://github.com/jedi4ever/hiera-puppet/commit/2250a9825ea3382bb0518d77c4f5a8b97667f4a0 
for details


On 06/04/12 18:54, psychobyte wrote:

Hi,

is there a fact or variable for the configuration version that I can 
access from hiera or my manifests? I'd like to embed it into my files.


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/-/y9V2HDKg-YQJ.

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.


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



Re: [Puppet Users] configuration version variable?

2012-04-06 Thread psychobyte
Thanks for the reply Patrick but, I should have been more specific. 

I wanted the puppet configuration version as in 

info: Applying configuration version '1333729957'

So any file that gets manipulated by puppet has it in a header.

Thanks.

On Friday, April 6, 2012 9:58:20 AM UTC-7, Patrick Debois wrote:

 I've implemented that - See pull request - 
 https://github.com/puppetlabs/hiera-puppet/pull/20

 See 

 https://github.com/jedi4ever/hiera-puppet/commit/2250a9825ea3382bb0518d77c4f5a8b97667f4a0
  
 for details

 On 06/04/12 18:54, psychobyte wrote:
  Hi,
 
  is there a fact or variable for the configuration version that I can 
  access from hiera or my manifests? I'd like to embed it into my files.
 
  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/-/y9V2HDKg-YQJ.
  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.



-- 
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/-/2dck78zcrOgJ.
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] selinux symlink patch

2012-04-06 Thread Chris Price
Hey folks,

I am reviewing the following pull request, which has to do with how puppet
deals with symlinks in selinux:

https://github.com/puppetlabs/puppet/pull/563

Just wondering if there is anyone out there who considers themselves strong
with selinux who has an opinion on this one way or the other.

Thanks in advance!
Chris

-- 
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: selinux symlink patch

2012-04-06 Thread Chris Price
Update: a little more digging reveals that the original selinux symlink
code came as a result of this ticket:

http://projects.puppetlabs.com/issues/2791

Still interested in feedback if anyone has any.


On Fri, Apr 6, 2012 at 12:58 PM, Chris Price ch...@puppetlabs.com wrote:

 Hey folks,

 I am reviewing the following pull request, which has to do with how puppet
 deals with symlinks in selinux:

 https://github.com/puppetlabs/puppet/pull/563

 Just wondering if there is anyone out there who considers themselves
 strong with selinux who has an opinion on this one way or the other.

 Thanks in advance!
 Chris


-- 
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] Hiera mysql backend problem

2012-04-06 Thread Alex D
Hi,

anyone managed to get a working setup based on hiera with mysql
backend? Here is the link to howto I followed:

http://www.craigdunn.org/2012/03/introducing-hiera-mysql-mysql-backend-for-hiera/

I've tried it but got problems – %{key} seems to be empty in SQL query
when puppet does hiera lookup. Here is the query from hiera.yaml
config file:

:query: SELECT val FROM nodes WHERE var=’%{key}’ AND server=’%{fqdn}’

Table nodes structure:

CREATE TABLE `nodes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server` varchar(255) DEFAULT NULL,
`var` varchar(255) DEFAULT NULL,
`val` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8

When I do hiera lookup from the command line it works just fine:

#hiera -c /etc/puppet/hiera.yaml owner fqdn=cluster2.int
tester

But when I run “puppetd -t” on the cluster2.int server I get this:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find data item owner in any Hiera data file and no
default supplied at /etc/puppet/modules/apache/manifests/init.pp:3 on
node cluster2.int

Line 3 in /etc/puppet/modules/apache/manifests/init.pp is:

$owner = hiera(‘owner’)

For debug purpose I’ve changed SQL query to the following:

:query: SELECT val FROM nodes WHERE var=%{key} AND server=’%{fqdn}
START%{key}END’

That’s what I got then:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near ‘AND server=’cluster2.int STARTEND” at line 1 at /etc/puppet/
modules/apache/manifests/init.pp:3 on node cluster2.int

So as you can see %{key} is empty in the SQL query ( ’%{fqdn} START%
{key}END’ tuns into cluster2.int STARTEND).

-- 
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] Puppet master not logging to file

2012-04-06 Thread Brian Pitts

Hi,

I'm running puppet 2.7.12 on CentOS 5.8. I'm having trouble getting the 
puppet master to log to a file. The same configuration is working fine 
for the puppet agent. A single line is written to the master's log file 
when it starts. When logging to syslog or the console, I get lots of 
output each time an agent talks to the master. When logging to a file, I 
get nothing. The master does not even appear to have the log file open. 
Below is my configuration and some shell output demonstrating the 
problem. Does this configuration work for others, or have I run into a bug?


$ egrep -v '#|^$' puppet.conf
[main]
vardir = /var/lib/puppet
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl
pluginsync = true
factpath = $vardir/lib/facter
autoflush = true
[agent]
server =  redacted
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig
listen = false
[master]
modulepath = redacted
storeconfigs = true
dbadapter = sqlite3
dblocation = $vardir/storeconfigs.sqlite
certname = redacted

$ egrep -v '#|^$' /etc/sysconfig/puppet
PUPPET_LOG=/var/log/puppet/agent.log
PUPPET_EXTRA_OPTS=--verbose

$ egrep -v '#|^$' /etc/sysconfig/puppetmaster
PUPPETMASTER_LOG=/var/log/puppet/master.log
PUPPETMASTER_EXTRA_OPTS=--verbose

$ ps -wwfp $(pgrep -fd, puppet)
UIDPID  PPID  C STIME TTY  TIME CMD
root 12566 1  6 18:33 ?00:00:53 /usr/bin/ruby 
/usr/sbin/puppetd --logdest=/var/log/puppet/agent.log --verbose
puppet   15612 1  5 18:43 ?00:00:15 /usr/bin/ruby 
/usr/sbin/puppetmasterd --logdest /var/log/puppet/master.log --verbose


$ sudo pkill -SIGUSR1 puppetd

$ sudo ls -lt /var/log/puppet/
total 25136
-rw-rw 1 puppet puppet 25661723 Apr  6 18:51 masterhttp.log
-rw-r--r-- 1 root   root  21638 Apr  6 18:51 agent.log
-rw--- 1 puppet puppet 3889 Apr  6 18:44 rails.log
-rw-r--r-- 1 root   root 68 Apr  6 18:43 master.log
-rw-r- 1 root   root   4850 Apr  4 17:02 http.log

$ sudo cat /var/log/puppet/master.log
Fri Apr 06 18:43:43 -0400 2012 Puppet (notice): Reopening log files

$ sudo tail -n 1 /var/log/puppet/agent.log
Fri Apr 06 18:51:47 -0400 2012 Puppet (notice): Finished catalog run in 
11.73 seconds


$ sudo fuser -s /var/log/puppet/agent.log; echo $?
0

$ sudo fuser -s /var/log/puppet/master.log; echo $?
1

--
Brian Pitts
Systems Administrator | EuPathDB Bioinformatics Resource Center
706-542-1447 | b...@uga.edu | http://eupathdb.org

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