Re: [Puppet Users] Definition including a class

2009-12-06 Thread Peter Meier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi

 I have a definition where I am trying to include a class...
 
 class db_deploy::base {
 $build_user = build
 }
 
 define db_deploy::elements($db_deploy_version) {
 include db_deploy::base
 
 # Use $build_user here
 }
 
 When I attempt to access $build_user in the db_deploy::elements
 definition, puppet thinks it has no value. What am I doing wrong?


the definition of the variable is only in the scope of the class.
However you can address it by direct name:

$ cat foo.pp
class a {
  $b = 'helo world'
}

define c(){
  include a
  notice($a::b)
}

c{'d': }
$ puppet foo.pp
notice: Scope(C[d]): helo world

but you have to include the class, otherwise the class isn't evaluated
hence you can't refer to its variables.

cheers pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAksbjY4ACgkQbwltcAfKi3/5dQCfZO3yputBjgzFSX23v62qYt7a
TpkAnjjlHdwKtrdZRJABNKYOJPFMs4Y1
=SpBF
-END PGP SIGNATURE-

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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] User Modification

2009-12-06 Thread jokeeffe
I'm trying to do something like this using puppet 0.24.8.

define removeuser() {
  @ user { $name:
  ensure = absent
  }

  realize User[$name]
}

$removelist = [bob, bill, billy]
@ removeuser { $removelist : }


It's failing with err: Could not retrieve catalog: Failed to realize
virtual resources User[bob] on node test. Is this even possible, if
not in version .24 or .25, in future versions?

Thanks

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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] Definition including a class

2009-12-06 Thread Douglas Garstang
On Sun, Dec 6, 2009 at 2:55 AM, Peter Meier peter.me...@immerda.ch wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Hi

 I have a definition where I am trying to include a class...

 class db_deploy::base {
     $build_user = build
 }

 define db_deploy::elements($db_deploy_version) {
     include db_deploy::base

     # Use $build_user here
 }

 When I attempt to access $build_user in the db_deploy::elements
 definition, puppet thinks it has no value. What am I doing wrong?


 the definition of the variable is only in the scope of the class.
 However you can address it by direct name:

 $ cat foo.pp
 class a {
  $b = 'helo world'
 }

 define c(){
  include a
  notice($a::b)
 }

 c{'d': }
 $ puppet foo.pp
 notice: Scope(C[d]): helo world

 but you have to include the class, otherwise the class isn't evaluated
 hence you can't refer to its variables.

That's not working for me Pete.

class db_deploy::base {
$build_user = build
 }

define db_deploy::starterkit($db_deploy_version, $db_type=mysql) {
include db_deploy::base
file {

${dir_deploy}/${db_deploy_version}/${db_type}/${dir_starterkit}/${db_deploy_version}/ant.properties.${db_deploy::base::build_user}:
content =
template(db_deploy/starterkit/ant.properties.${build_user}),
require =
File[${dir_deploy}/${db_deploy_version}/${db_type}/${dir_starterkit}/${db_deploy_version}],
}
}

Results in puppet telling me that the path doesn't exist... because
the value of ${db_deploy::base::build_user} is empty. I've also tried
$db_deploy::base::build_user and got the same result.

Doug.

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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] other end went away leads to multiple report mails

2009-12-06 Thread Neil Prockter
Evening All,

I've been getting a random number of copies of report mails, the same 
report sent multiple times at the same second, and finally got tired 
enough of it to look into it.

They are sent from puppet rather than a mail server issue.

I get one extra copy every time the client gets a warning: Other end 
went away; restarting connection and retrying.

Updating the server from 0.24.8 to 0.25.1 did not improve matters.

Running with client 0.24.5 debug ends with

debug: Calling puppetreports.report
warning: Other end went away; restarting connection and retrying
warning: Other end went away; restarting connection and retrying
info: Sent transaction report in 3.29 seconds
notice: Finished catalog run in 11.40 seconds

upgrading the client to 0.24.8 client debug ends with

debug: Calling puppetreports.report
info: Other end went away; restarting connection and retrying
info: Other end went away; restarting connection and retrying
info: Sent transaction report in 3.66 seconds
notice: Finished catalog run in 12.61 seconds

so the level has been reduced to info but I still get the multiple 
report mails

updating to 0.25.1 seems to deal with the repeated mails though I see

err: Reporting failed: end of file reached

Updating clients to 0.25.1 across the board is probably not an option 
for me so I'd like to fix the reporting from a server side if possible.

My tagmail.conf is just
all: an-addr...@that.goes.to.me

Neil

Please access the attached hyperlink for an important electronic communications 
disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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] /wiki/TypeReference is slow/timing out

2009-12-06 Thread Rob Chanter
On Thu, Dec 3, 2009 at 11:53 AM, Luke Kanies l...@madstop.com wrote:


 Looks like Bruce will be modifying RailsGuides to use Markdown, and
 we'll use that.


Github-flavored Markdown? Makes a few tweaks to standard Markdown that
are a Good Thing for code-centric documentation.

cheers
rob

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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: other end went away leads to multiple report mails

2009-12-06 Thread Greg
Neil,

I had a similar problem back when I was running 0.24.7 and 0.24.8 on
Solaris. My solution was to remove tagmail completely and put in a
seperate system that parsed the YAML reports and send a single email
combining all changes during a given period of time (in my case -
daily). Required a little coding, but its not too difficult. Then just
schedule it to run from cron on each of your master servers that
receive reports from clients.

To be honest, tagmail isn't that useful outside of running it on a few
hosts... I personally don't want to receive 100+ emails every time I
changed an entry that was common to every node... This way I receive
one email in a summarised format - if I need more detail there is
always the messages file on the node itself, or you can optionally
keep the reports for a few days... Just remember to set up a tidy on
the reports directory if you do that... (Oh, and if you set up a tidy
on the reports directory, you may want to bear in mind Bug 2701:
http://projects.reductivelabs.com/issues/2701)

The base of the code is something like:

require puppet
require yaml
require find
Puppet[:config] = /etc/puppet/puppet.conf
Puppet.parse_config
Puppet[:name] = puppetmasterd
Puppet::Node::Facts.terminus_class = :yaml
File.find(/var/puppet/reports) do | report |
  next if FileTest.directory?(report)
  thisreport = open(report) { |fh| YAML::load(fh) }
  print Host:  + thisreport.host
  reporttime = File.stat(report).mtime.to_i # seconds since epoch...
  thisreport.logs.each do |log|
# Whatever you want to find out about each message...
  end
  File.unlink(report) # If you don't need them anymore...
end

On Dec 7, 10:33 am, Neil Prockter n.prock...@lse.ac.uk wrote:
 Evening All,

 I've been getting a random number of copies of report mails, the same
 report sent multiple times at the same second, and finally got tired
 enough of it to look into it.

 They are sent from puppet rather than a mail server issue.

 I get one extra copy every time the client gets a warning: Other end
 went away; restarting connection and retrying.

 Updating the server from 0.24.8 to 0.25.1 did not improve matters.

 Running with client 0.24.5 debug ends with

 debug: Calling puppetreports.report
 warning: Other end went away; restarting connection and retrying
 warning: Other end went away; restarting connection and retrying
 info: Sent transaction report in 3.29 seconds
 notice: Finished catalog run in 11.40 seconds

 upgrading the client to 0.24.8 client debug ends with

 debug: Calling puppetreports.report
 info: Other end went away; restarting connection and retrying
 info: Other end went away; restarting connection and retrying
 info: Sent transaction report in 3.66 seconds
 notice: Finished catalog run in 12.61 seconds

 so the level has been reduced to info but I still get the multiple
 report mails

 updating to 0.25.1 seems to deal with the repeated mails though I see

 err: Reporting failed: end of file reached

 Updating clients to 0.25.1 across the board is probably not an option
 for me so I'd like to fix the reporting from a server side if possible.

 My tagmail.conf is just
 all: an-addr...@that.goes.to.me

 Neil

 Please access the attached hyperlink for an important electronic 
 communications 
 disclaimer:http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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] other end went away leads to multiple report mails

2009-12-06 Thread Ohad Levy
Hi,

when developing Foreman[1], I've also seen it similar problem (Reports are
being sent more than once).

I've worked around it in Foreman, maybe that would be a better alternative
to tagmail altogether.

Cheers,
Ohad

*1 http://theforeman.org


On Mon, Dec 7, 2009 at 7:33 AM, Neil Prockter n.prock...@lse.ac.uk wrote:

 Evening All,

 I've been getting a random number of copies of report mails, the same
 report sent multiple times at the same second, and finally got tired
 enough of it to look into it.

 They are sent from puppet rather than a mail server issue.

 I get one extra copy every time the client gets a warning: Other end
 went away; restarting connection and retrying.

 Updating the server from 0.24.8 to 0.25.1 did not improve matters.

 Running with client 0.24.5 debug ends with

 debug: Calling puppetreports.report
 warning: Other end went away; restarting connection and retrying
 warning: Other end went away; restarting connection and retrying
 info: Sent transaction report in 3.29 seconds
 notice: Finished catalog run in 11.40 seconds

 upgrading the client to 0.24.8 client debug ends with

 debug: Calling puppetreports.report
 info: Other end went away; restarting connection and retrying
 info: Other end went away; restarting connection and retrying
 info: Sent transaction report in 3.66 seconds
 notice: Finished catalog run in 12.61 seconds

 so the level has been reduced to info but I still get the multiple
 report mails

 updating to 0.25.1 seems to deal with the repeated mails though I see

 err: Reporting failed: end of file reached

 Updating clients to 0.25.1 across the board is probably not an option
 for me so I'd like to fix the reporting from a server side if possible.

 My tagmail.conf is just
 all: an-addr...@that.goes.to.me

 Neil

 Please access the attached hyperlink for an important electronic
 communications disclaimer:
 http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm

 --

 You received this message because you are subscribed to the Google Groups
 Puppet Users group.
 To post to this group, send email to puppet-us...@googlegroups.com.
 To unsubscribe from this group, send email to
 puppet-users+unsubscr...@googlegroups.compuppet-users%2bunsubscr...@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-us...@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] Definition including a class

2009-12-06 Thread Peter Meier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 That's not working for me Pete.
 
 class db_deploy::base {
 $build_user = build
  }
 
 define db_deploy::starterkit($db_deploy_version, $db_type=mysql) {
 include db_deploy::base
 file {
 
 ${dir_deploy}/${db_deploy_version}/${db_type}/${dir_starterkit}/${db_deploy_version}/ant.properties.${db_deploy::base::build_user}:
 content =
 template(db_deploy/starterkit/ant.properties.${build_user}),
 require =
 File[${dir_deploy}/${db_deploy_version}/${db_type}/${dir_starterkit}/${db_deploy_version}],
 }
 }
 
 Results in puppet telling me that the path doesn't exist... because
 the value of ${db_deploy::base::build_user} is empty. I've also tried
 $db_deploy::base::build_user and got the same result.

$ cat foo.pp
class db_deploy::base {
  $build_user = 'helo world'
}

define db_deploy::starterkit(){
  include db_deploy::base
  notice(${db_deploy::base::build_user})
}

db_deploy::starterkit{'d': }
$ puppet foo.pp
notice: Scope(Db_deploy::Starterkit[d]): helo world

Tested on 0.24.8 and 0.25.1

Did I miss a something due to not yet enough coffee?

Why do I not see the class dependent variable call in your example?
CopyPaste error?

cheers pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkscrbUACgkQbwltcAfKi3/tNACeIpHrw84sSEQdrc9m1oue0o1P
Z+wAn0m1sBK/9TP7P2TmsUSBwlBh3wWX
=1pcE
-END PGP SIGNATURE-

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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: other end went away leads to multiple report mails

2009-12-06 Thread Peter Meier
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

 The base of the code is something like:
 
 require puppet
 require yaml
 require find
 Puppet[:config] = /etc/puppet/puppet.conf
 Puppet.parse_config
 Puppet[:name] = puppetmasterd
 Puppet::Node::Facts.terminus_class = :yaml
 File.find(/var/puppet/reports) do | report |
   next if FileTest.directory?(report)
   thisreport = open(report) { |fh| YAML::load(fh) }
   print Host:  + thisreport.host
   reporttime = File.stat(report).mtime.to_i # seconds since epoch...
   thisreport.logs.each do |log|
 # Whatever you want to find out about each message...
   end
   File.unlink(report) # If you don't need them anymore...
 end


would be nice to have such a working example in ext/

cheers pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkscrloACgkQbwltcAfKi3/LiACfQXDDbclJkGlofQxYUkvw09me
9A0AoI/IHHoBJhEiCZKkLlecvdwd1cgb
=MuV0
-END PGP SIGNATURE-

--

You received this message because you are subscribed to the Google Groups 
Puppet Users group.
To post to this group, send email to puppet-us...@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.