Re: [Puppet Users] Why agent report is so slow?

2012-09-17 Thread flex
Thank you, Daniel.
Then how can we make puppet not generate the reports? I try to add
'report=false', but seems no effect.

On Sat, Sep 15, 2012 at 2:46 AM, Daniel Pittman dan...@puppetlabs.comwrote:

 On Fri, Sep 14, 2012 at 3:16 AM, flex frostyn...@gmail.com wrote:
  Thanks, Daniel. We do have some recursive file copies and hundreds of
 other
  resources. So we'd better decrease the resources numbers?

 Well, that would be the only short term path to making report output
 faster - but, in general, if you are managing it you probably need to
 be managing it.  :)

 --
 Daniel Pittman
 ⎋ Puppet Labs Developer – http://puppetlabs.com
 ♲ Made with 100 percent post-consumer electrons

 --
 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] Why agent report is so slow?

2012-09-17 Thread flex
Sometimes we use puppet agent --test --environment xxx to debug puppet
configuration. The 2 minutes and more execution time is unacceptable. As
agent output is enough, we do not need the report that time. This is why i
want to disable the reports.

On Mon, Sep 17, 2012 at 11:44 PM, Daniel Pittman dan...@puppetlabs.comwrote:

 The agent builds up an in-memory report no matter what; you can't avoid
 that.

 You could write a null report terminus that responds to save by
 simply discarding the data, though.  That would remove the cost of
 YAML serialization.

 I guess the key question, though, is why you feel you need this?

 On Mon, Sep 17, 2012 at 12:14 AM, flex frostyn...@gmail.com wrote:
  Thank you, Daniel.
  Then how can we make puppet not generate the reports? I try to add
  'report=false', but seems no effect.
 
  On Sat, Sep 15, 2012 at 2:46 AM, Daniel Pittman dan...@puppetlabs.com
  wrote:
 
  On Fri, Sep 14, 2012 at 3:16 AM, flex frostyn...@gmail.com wrote:
   Thanks, Daniel. We do have some recursive file copies and hundreds of
   other
   resources. So we'd better decrease the resources numbers?
 
  Well, that would be the only short term path to making report output
  faster - but, in general, if you are managing it you probably need to
  be managing it.  :)
 
  --
  Daniel Pittman
  ⎋ Puppet Labs Developer – http://puppetlabs.com
  ♲ Made with 100 percent post-consumer electrons
 
  --
  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.



 --
 Daniel Pittman
 ⎋ Puppet Labs Developer – http://puppetlabs.com
 ♲ Made with 100 percent post-consumer electrons

 --
 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] Why agent report is so slow?

2012-09-14 Thread flex
Thanks, Daniel. We do have some recursive file copies and hundreds of other
resources. So we'd better decrease the resources numbers?

On Fri, Sep 14, 2012 at 2:44 AM, Daniel Pittman dan...@puppetlabs.comwrote:

 On Thu, Sep 13, 2012 at 12:31 AM, flex frostyn...@gmail.com wrote:
 
  I use cron to run puppet agent, but recently i found the script takes too
  long time. After using '--debug', i got this log:
 
  2012-09-13 15:19:53.928744500 debug: Finishing transaction 69941650538440
  2012-09-13 15:19:53.928988500 debug: Storing state
  2012-09-13 15:19:54.930995500 debug: Stored state in 1.00 seconds
  2012-09-13 15:19:54.931145500 notice: Finished catalog run in 48.21
 seconds
  2012-09-13 15:20:03.721411500 debug: Value of
  'preferred_serialization_format' (pson) is invalid for report, using
 default
  (b64_zlib_yaml)
  2012-09-13 15:20:03.721578500 debug: report supports formats:
 b64_zlib_yaml
  raw yaml; using b64_zlib_yaml
  2012-09-13 15:21:10.805932500 Puppet run done.
 
  The last 'Puppet run done' is a bash echo after puppet agent. So we can
 see
  it took 1 minute and more before the echo line. But if i set 'report =
  false' in puppet.conf, there is no such long time. Does puppet use this
 time
  to generate and send reports?

 In essence, yes: we build the report structure as we go, but
 transforming it for submission, and sending it over the wire,
 certainly take time.  That is proportional to the number of resources
 you have in your catalog, including things like recursive file copies
 or tidies.

 How can i tune this?

 There really isn't any way to improve performance: there isn't (much)
 you can do to improve YAML output performance - although Telly, Puppet
 3.0.0, will be a bit faster at building YAML when it is released.

 You could check to see if the performance problem comes from network
 transmission problems, but really there isn't much you can do to
 improve a single HTTPS request, which is how we submit the report back
 to the the master.

 --
 Daniel Pittman
 ⎋ Puppet Labs Developer – http://puppetlabs.com
 ♲ Made with 100 percent post-consumer electrons

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



[Puppet Users] Why agent report is so slow?

2012-09-13 Thread flex
Hi, all:

I use cron to run puppet agent, but recently i found the script takes too
long time. After using '--debug', i got this log:

2012-09-13 15:19:53.928744500 debug: Finishing transaction 69941650538440
2012-09-13 15:19:53.928988500 debug: Storing state
2012-09-13 15:19:54.930995500 debug: Stored state in 1.00 seconds
2012-09-13 15:19:54.931145500 notice: Finished catalog run in 48.21 seconds
2012-09-13 15:20:03.721411500 debug: Value of
'preferred_serialization_format' (pson) is invalid for report, using
default (b64_zlib_yaml)
2012-09-13 15:20:03.721578500 debug: report supports formats: b64_zlib_yaml
raw yaml; using b64_zlib_yaml
2012-09-13 15:21:10.805932500 Puppet run done.

The last 'Puppet run done' is a bash echo after puppet agent. So we can see
it took 1 minute and more before the echo line. But if i set 'report =
false' in puppet.conf, there is no such long time. Does puppet use this
time to generate and send reports? How can i tune this?

-- 
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] How to handle multiple definitions of the same package in multiple included modules?

2012-03-19 Thread flex
you can put the package resource in a single class, and include this class
in app[1-3],  alternatively, try virtual resources, see:
http://docs.puppetlabs.com/guides/virtual_resources.html

On Mon, Mar 19, 2012 at 9:15 AM, EmmEff mike...@gmail.com wrote:

 How to handle this scenario?

 Assume that all three apps are defined in three separate modules.  All
 three modules are mutually exclusive with the exception that they require
 the same packageA to be installed.

 Pseudocode:

 class module1::app1 {
   package {
 'packageA':
   ;
   }
 }

 class module2::app2 {
   package {
 'packageA':
   ;
   }
 }

 class module3::app3 {
   package {
 'packageA':
   ;
   }
 }

 -- site.pp

 node 'mynode.example.com' {
   include module1::app1
   include module2::app2
   include module3::app3
 }

 This will give me an error that packageA is already defined in another
 file.  I *know* I'm missing something simple, but what is it?  How can I
 avoid this situation of the duplicate package definitions while ensuring
 the resource Package['packageA'] is created?

 I tried the following but I guess I'm not understanding the defined()
 function properly:

 class module1::app1 {
   if ! defined(Package['packageA']) {
 package {
   'packageA':
 ;
 }
   }
 }

 Forgive me if this is an oft asked question.  I couldn't figure out the
 search term that made sense that would match this scenario.  TIA

 Mike.

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



[Puppet Users] require custom ruby code in custom function

2012-03-05 Thread flex
hi, all:

i want to require my own ruby class in a custom function, now i put the
ruby file in the same directory with custom function, and require it in the
function file like this:

require File.join([File.expand_path(File.dirname(__FILE__)), 'test.rb'])

but i think this is too ugly,  is there any other way?

-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] Skipped schedule resources in reports

2011-11-29 Thread flex
i met this problem too, and also don't know why some resource's type turned
into Schedule, are there someone can give me a reason?

On Tue, Sep 6, 2011 at 10:21 PM, Greg Sutcliffe greg.sutcli...@gmail.comwrote:

 Hi all,

 Since upgrading a few test machines from 2.6.7 to 2.7.3, I've noticed
 something slightly odd. Every single run reports 6 skipped resources, yet
 the reports are empty - they only state the execution time as per
 usual). On digging further it seems that the auto-generated Schedule
 resources (type/schedule.rb, line 307) are the entities being skipped,
 presumably because I'm not using them in any of my manifests.

 This is leading to a lot of reports with spurious data in them - since I
 don't use schedules, why should I care that Puppet skipped the default
 ones? This wouldn't be an issue, but I'm processing the reports and
 producing emails which summarize activity in the last hour, so for every
 2.7.3 node, I'm seeing 12 skipped resources per hour, which is noise that
 swamps the real data of resources that have changed for good reason.

 Is there a way to disable these default schedules, or the reporting of
 them? I tried --ignoreschedules on the commandline, but I get the
 impression that this causes other resources to run outside their normal
 schedule, rather than disabling the schedules themselves.

 As a hack, I added return Array.new to the self.mkdefaultschedules
 listed above, which stops the resources being generated, but this seems an
 ugly hack, and one I seem to have to make on every node. Is there a better
 way?

 Regards,
 Greg

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




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] Skipped schedule resources in reports

2011-11-29 Thread flex
oh, i make a mistake, the schedule resources are not turned from other
resources, they are created by default.
my puppet is 2.7.6

On Tue, Nov 29, 2011 at 5:49 PM, flex frostyn...@gmail.com wrote:

 i met this problem too, and also don't know why some resource's type
 turned into Schedule, are there someone can give me a reason?


 On Tue, Sep 6, 2011 at 10:21 PM, Greg Sutcliffe 
 greg.sutcli...@gmail.comwrote:

 Hi all,

 Since upgrading a few test machines from 2.6.7 to 2.7.3, I've noticed
 something slightly odd. Every single run reports 6 skipped resources, yet
 the reports are empty - they only state the execution time as per
 usual). On digging further it seems that the auto-generated Schedule
 resources (type/schedule.rb, line 307) are the entities being skipped,
 presumably because I'm not using them in any of my manifests.

 This is leading to a lot of reports with spurious data in them - since I
 don't use schedules, why should I care that Puppet skipped the default
 ones? This wouldn't be an issue, but I'm processing the reports and
 producing emails which summarize activity in the last hour, so for every
 2.7.3 node, I'm seeing 12 skipped resources per hour, which is noise that
 swamps the real data of resources that have changed for good reason.

 Is there a way to disable these default schedules, or the reporting of
 them? I tried --ignoreschedules on the commandline, but I get the
 impression that this causes other resources to run outside their normal
 schedule, rather than disabling the schedules themselves.

 As a hack, I added return Array.new to the self.mkdefaultschedules
 listed above, which stops the resources being generated, but this seems an
 ugly hack, and one I seem to have to make on every node. Is there a better
 way?

 Regards,
 Greg

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




 --
 System Administrator, Focus on System Management and Basic Development




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] What is the offical variable scope best practice?

2011-11-16 Thread flex
I read the guide at
http://docs.puppetlabs.com/guides/scope_and_puppet.htmland others'
mail, i am a little confused now, below is my understanding:

1. top scope only refers to site.pp, not include node definitions and facts.
2. in puppet class, using variables not local, must specify the namespace,
like $class::variable,
if it's a top scope variable or a fact variable or a variable in node
definition, using $::variable.
3. in template erb files, always using scope.lookupvar(class::variable)
to get the value, even if the erb and the variable used in the same module
or it is a fact variable

are these points correct?

btw, only some of my old code give dynamic lookup warnings under puppet
2.7, does this mean the others not need to modify?


-- 
System Administrator, Focus on System Management and Basic Development

-- 
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: What is the offical variable scope best practice?

2011-11-16 Thread flex
Very thanks for your detailed explanation :)

For the last question, what doubt me is only fact variables in a template
which is invoked by a define will throw the warning,
if the template is invoked by a class, everything is ok.

On Wed, Nov 16, 2011 at 10:54 PM, jcbollinger john.bollin...@stjude.orgwrote:



 On Nov 16, 3:59 am, flex frostyn...@gmail.com wrote:
  I read the guide athttp://
 docs.puppetlabs.com/guides/scope_and_puppet.htmlandothers'
  mail, i am a little confused now, below is my understanding:
 
  1. top scope only refers to site.pp, not include node definitions and
 facts.


 Top scope refers to anything outside all class and node definitions.
 Top scope variables can appear in any manifest file, but site.pp is a
 very good choice because it is always processed, and first.  Top scope
 variables in most other locations may sometimes fail to be visible in
 manifests other than the ones where they appear.

 If you put a class or node definition in site.pp, that class's or
 node's variables are not in top scope.

 Facts certainly are in top scope; in some manifest sets they are the
 *only* variables in top scope.


  2. in puppet class, using variables not local, must specify the
 namespace,
  like $class::variable,
  if it's a top scope variable or a fact variable or a variable in node
  definition, using $::variable.


 For Puppet 2.7.x and below, this is not always the case: you can
 access variables in the current dynamic scope by their simple names.
 Top scope variables are always in the current dynamic scope, but a
 narrower scope might define a variable having the same simple name, so
 it is always safest to use $::variable when that's what you mean.
 Dynamic scope can apply to class variables, too, but again it's safest
 to use refer to non-local variables by their fully-qualified names.

 Starting in Puppet 2.8, however, it will be mandatory to refer to non-
 local variables by their fully-qualified names.  In preparation for
 that, Puppet 2.7.x emits warning when your manifests resolve non-local
 variables from the dynamic scope.


  3. in template erb files, always using scope.lookupvar(class::variable)
  to get the value, even if the erb and the variable used in the same
 module
  or it is a fact variable


 The docs suggest that templates can use all the simple variable names
 that can be resolved in the scope where they are invoked, but I cannot
 independently confirm that.  Certainly, wherever you need or want to
 use a qualified name, scope.lookupvar() is your tool.


  are these points correct?
 
  btw, only some of my old code give dynamic lookup warnings under puppet
  2.7, does this mean the others not need to modify?


 I doubt it would be safe to say that manifests that do not elicit
 dynamic lookup warnings will not need any modification to work with
 Puppet 2.8.  Also, do understand that it is not necessarily the case
 that every manifest is processed for every client, so you have to take
 care in judging which code gives warnings and which doesn't.


 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.




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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: What is the offical variable scope best practice?

2011-11-16 Thread flex
Does the @ method is supported by puppet 2.8? During my test, it can also
be used not only ahead facts variable but also the variable in its parent
class, it is this a wordaround for dynamic scope problem?

On Thu, Nov 17, 2011 at 2:39 AM, Nigel Kersten ni...@puppetlabs.com wrote:



 On Wed, Nov 16, 2011 at 8:03 AM, flex frostyn...@gmail.com wrote:

 Very thanks for your detailed explanation :)

 For the last question, what doubt me is only fact variables in a template
 which is invoked by a define will throw the warning,
 if the template is invoked by a class, everything is ok.


 Use it as an instance variable, like @factname

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

 We should definitely have documented this better, and we'll do so.

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




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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 custom fuction run as user pupprt?

2011-07-14 Thread flex
I wrote a custom fuction to read a root read-only file, it raised an
Permission Denied error.
During debug, i found  this fuction seems to run as user puppet, it is this
a feature or a bug?

-- 
System Administrator, Focus on System Management and Basic Development

-- 
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 should return non-zero when exec failed

2011-07-10 Thread flex
When there is an error in exec resource, puppet command also returns zero.

-- 
System Administrator, Focus on System Management and Basic Development

-- 
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: puppet should return non-zero when exec failed

2011-07-10 Thread flex
Oh, i found --detailed-exitcodes here:
http://projects.puppetlabs.com/issues/5859

2011/7/11 flex frostyn...@gmail.com

 When there is an error in exec resource, puppet command also returns zero.

 --
 System Administrator, Focus on System Management and Basic Development




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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: How to manage many nodes easily?

2011-06-24 Thread flex
What a good solution! Thanks a lot!

2011/6/24 Nan Liu n...@puppetlabs.com

 On Thu, Jun 23, 2011 at 7:43 PM, flex frostyn...@gmail.com wrote:
  er...that's what we use now, but define and external node cannot use
  together, we want to use external node to manage nodes configuration
 easily,
  so that's why i want to change all the define to class

 ENC doesn't support resources, and defines are custom resources,
 however we can still support ENC by defining this in an app class:

 class app { $software ) {
  app::deploy { $software: }
 }

 define app::deploy {
  app:: add { $name:
 path = /var/$name
  }
 }

 node some_system {
  class { app:
 software = ['app1', 'app2', 'app3'],
  }
 }

 ENC support for parametrized class was added in 2.6.5+. If you need to
 pass custom parameters to the resource, use a hash or write a wrapper
 class for create_resource function to handle any complex usage, and
 that function can be backported from 2.7 to 2.6.x.

 Thanks,

 Nan

  2011/6/23 Martin Alfke tux...@gmail.com
 
  On 06/23/2011 11:52 AM, flex wrote:
   But i think class is singletons, means when using class you can not
 get
   more than one copy of the resource, that's the biggest difference
   between class and define.
  
   Your example give a duplicate definition error in my environment.
  
   So is this my fault or there another way?
 
  You are right. Using class does not work here. But you can use a define
  with parameters and call the define with parameters later on:
 
  define application::add ($appname) {
 file { /var/$appname:
 ensure = directory,
 }
  }
 
  node 'node1' {
 application::add { app1: appname = app1 }
 application::add { app3: appname = app3 }
  }
  node 'node2' {
 application::add { app2: appname = app2 }
 application::add { anyname: appname = app4 }
  }
 
  When calling the define you just have to make sure that the give name is
  uniq.
 
 
  
   2011/6/23 Martin Alfke tux...@gmail.com mailto:tux...@gmail.com
  
  
  
   On Jun 23, 7:44 am, Martin Alfke tux...@gmail.com
   mailto:tux...@gmail.com wrote:
On 06/23/2011 04:35 AM, flex wrote:
   
 These is another question, i have many defines which will
 apply
   an
 application to sepcified path, called as:
   
 application::add { app1: path = /var/app1 }
   
 by this i can apply app1 and app2 in node1, app3 and app4 in
   node2, etc.
   
 now, how do i switch this to a class? Need i create a seperate
   class for
 all the apps although the only difference is the path?
   
You can make use of parameterized classes:
   
class application::add($appname) {
path = '/var/${appname}',
...
   
 }
   
Within your node definition you call the class with desired
   parameter:
   
node 'node1' {
class application::add { appname = 'app1' }
class application::add { appname = 'app3' }
   
}
  
   The mentioned usage of parameterized classes in node definition is
   wrong.
   See:
  
  
 http://docs.puppetlabs.com/guides/language_guide.html#parameterised-classes
  
   node 'node1' {
  class { 'application::app': appname = 'app1' }
  class { 'application::add': appname = 'app3' }
   }
  
   
Kind regards,
   
Martin
   
   
   
   
   
   
   
   
   
 2011/6/21 Chris Phillips ch...@untrepid.com
   mailto:ch...@untrepid.com mailto:ch...@untrepid.com
   mailto:ch...@untrepid.com
   
 I would see a principle whereby nodes should not ever be
   defined
 within the manifest code at all. To me the manifests
 should
   be
 written to be very generic, and then use ENC's to modify
   their
 behaviour at a user level. There is still a lot of
   inconsistency
 within Puppet as to how device specific data can be
 obtained
 (extlookup is very useful but rides roughshod over other
 architectural principles) but I try to stick to keeping
 all
 manifests generic. I write manifests to manage a package,
   then
 create a group in dashboard to relate that function to a
   business
 need and then a node into that group.
   
 On 21 June 2011 14:48, Martin Willemsma
   mwillem...@gmail.com mailto:mwillem...@gmail.com
 mailto:mwillem...@gmail.com mailto:mwillem...@gmail.com
 
   wrote:
   
 We use /etc/puppet/node-definitions/*.pp in site.pp
   similar to
 what Carles is saying.
   
 [node-definitions] is a git repo thats being synced on
   both
 puppermasters. This happens on every push to origin
   
 We use the 'default

Re: [Puppet Users] Re: How to manage many nodes easily?

2011-06-23 Thread flex
But i think class is singletons, means when using class you can not get more
than one copy of the resource, that's the biggest difference between class
and define.

Your example give a duplicate definition error in my environment.

So is this my fault or there another way?

2011/6/23 Martin Alfke tux...@gmail.com



 On Jun 23, 7:44 am, Martin Alfke tux...@gmail.com wrote:
  On 06/23/2011 04:35 AM, flex wrote:
 
   These is another question, i have many defines which will apply an
   application to sepcified path, called as:
 
   application::add { app1: path = /var/app1 }
 
   by this i can apply app1 and app2 in node1, app3 and app4 in node2,
 etc.
 
   now, how do i switch this to a class? Need i create a seperate class
 for
   all the apps although the only difference is the path?
 
  You can make use of parameterized classes:
 
  class application::add($appname) {
  path = '/var/${appname}',
  ...
 
   }
 
  Within your node definition you call the class with desired parameter:
 
  node 'node1' {
  class application::add { appname = 'app1' }
  class application::add { appname = 'app3' }
 
  }

 The mentioned usage of parameterized classes in node definition is
 wrong.
 See:
 http://docs.puppetlabs.com/guides/language_guide.html#parameterised-classes

 node 'node1' {
class { 'application::app': appname = 'app1' }
 class { 'application::add': appname = 'app3' }
 }

 
  Kind regards,
 
  Martin
 
 
 
 
 
 
 
 
 
   2011/6/21 Chris Phillips ch...@untrepid.com mailto:
 ch...@untrepid.com
 
   I would see a principle whereby nodes should not ever be defined
   within the manifest code at all. To me the manifests should be
   written to be very generic, and then use ENC's to modify their
   behaviour at a user level. There is still a lot of inconsistency
   within Puppet as to how device specific data can be obtained
   (extlookup is very useful but rides roughshod over other
   architectural principles) but I try to stick to keeping all
   manifests generic. I write manifests to manage a package, then
   create a group in dashboard to relate that function to a business
   need and then a node into that group.
 
   On 21 June 2011 14:48, Martin Willemsma mwillem...@gmail.com
   mailto:mwillem...@gmail.com wrote:
 
   We use /etc/puppet/node-definitions/*.pp in site.pp similar to
   what Carles is saying.
 
   [node-definitions] is a git repo thats being synced on both
   puppermasters. This happens on every push to origin
 
   We use the 'default' node which does the baseline configuration
   based on a 'role'
 
   In a separate file $fqdn.pp I place the definitions for a node.
 
   Are there more people using this kind of approach?
 
   ---
   Martin
 
   2011/6/21 Carles Amig� carles.am...@softonic.com
   mailto:carles.am...@softonic.com
 
   We had the same problem and we just separated each node (or
   group of nodes) in one file and then we load them using the
   following syntax:
 
  import nodes/*.pp
 
   You could also organize those files in subdirectories if
 you
   like so:
 
  import nodes/*/*.pp
 
   The only problem we've found with this approach is when
   creating new files, puppetmaster takes a while to see
 them.
 
   El 20/06/2011 5:25, flex escribi�:
 
   We have many modules and many nodes, every node may use
   different
   module, so it's very unpleasant to modify the nodes.pp
   Then i saw the external node, but seems it only support
   class and we
   have many defines called in node.pp
 
   So here is my question: Is there another way for us to
   manage so many
   nodes easily or should i change all the defines to
   classes and using
   external nodes?
 
   --
   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
   mailto:puppet-users@googlegroups.com.
   To unsubscribe from this group, send email to
   puppet-users+unsubscribe@__googlegroups.com
   mailto:puppet-users%2bunsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/__group/puppet-users?hl=en
   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

Re: [Puppet Users] How to manage many nodes easily?

2011-06-22 Thread flex
These is another question, i have many defines which will apply an
application to sepcified path, called as:

application::add { app1: path = /var/app1 }

by this i can apply app1 and app2 in node1, app3 and app4 in node2, etc.

now, how do i switch this to a class? Need i create a seperate class for all
the apps although the only difference is the path?

2011/6/21 Chris Phillips ch...@untrepid.com

 I would see a principle whereby nodes should not ever be defined within
 the manifest code at all. To me the manifests should be written to be very
 generic, and then use ENC's to modify their behaviour at a user level.
 There is still a lot of inconsistency within Puppet as to how device
 specific data can be obtained (extlookup is very useful but rides roughshod
 over other architectural principles) but I try to stick to keeping all
 manifests generic. I write manifests to manage a package, then create a
 group in dashboard to relate that function to a business need and then a
 node into that group.


 On 21 June 2011 14:48, Martin Willemsma mwillem...@gmail.com wrote:

 We use /etc/puppet/node-definitions/*.pp in site.pp similar to what Carles
 is saying.

 [node-definitions] is a git repo thats being synced on both puppermasters.
 This happens on every push to origin

 We use the 'default' node which does the baseline configuration based on a
 'role'

 In a separate file $fqdn.pp I place the definitions for a node.

 Are there more people using this kind of approach?


 ---
 Martin


 2011/6/21 Carles Amigó carles.am...@softonic.com

 We had the same problem and we just separated each node (or group of
 nodes) in one file and then we load them using the following syntax:

import nodes/*.pp

 You could also organize those files in subdirectories if you like so:

import nodes/*/*.pp

 The only problem we've found with this approach is when creating new
 files, puppetmaster takes a while to see them.


 El 20/06/2011 5:25, flex escribió:

  We have many modules and many nodes, every node may use different
 module, so it's very unpleasant to modify the nodes.pp
 Then i saw the external node, but seems it only support class and we
 have many defines called in node.pp

 So here is my question: Is there another way for us to manage so many
 nodes easily or should i change all the defines to classes and using
 external nodes?


 --
 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+unsubscribe@*
 *googlegroups.com puppet-users%2bunsubscr...@googlegroups.com.
 For more options, visit this group at http://groups.google.com/**
 group/puppet-users?hl=enhttp://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.


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




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] How to manage many nodes easily?

2011-06-20 Thread flex
thanks Ohad and Ken, i am using foreman now, but only for logging reports, i
think i should try to restructe our config and use external node with
forman.

2011/6/20 Ken Barber k...@puppetlabs.com

 Do you have a lot of boxes that perform the same function? You can use
 the regex node syntax:

 node /^db/ {
  include db
 }

 Or device some other way of extracting function out of the machine
 name. It might save you some time.

 Otherwise if your machines are fairly unique using ENC to configure
 that would be a good path if you are getting sick of updating your
 nodes file. Dashboard and The Foreman are two good tools to look at
 for this purpose.

 Ideally you want your node entries to contain only vars and classes
 for a switchover to ENC to work. Param classes aren't supported in
 either tool yet I believe.

 ken.

 On Mon, Jun 20, 2011 at 4:25 AM, flex frostyn...@gmail.com wrote:
  We have many modules and many nodes, every node may use different module,
 so
  it's very unpleasant to modify the nodes.pp
  Then i saw the external node, but seems it only support class and we have
  many defines called in node.pp
 
  So here is my question: Is there another way for us to manage so many
 nodes
  easily or should i change all the defines to classes and using external
  nodes?
 
  --
  System Administrator, Focus on System Management and Basic Development
 
  --
  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.




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] How to manage many nodes easily?

2011-06-19 Thread flex
We have many modules and many nodes, every node may use different module, so
it's very unpleasant to modify the nodes.pp
Then i saw the external node, but seems it only support class and we have
many defines called in node.pp

So here is my question: Is there another way for us to manage so many nodes
easily or should i change all the defines to classes and using external
nodes?

-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] $caller_module_name sometimes not be set

2011-03-29 Thread flex
modules/redarrow/manifests/init.pp:

define redarrow::add_redarrow($redarrow_file) {
notice($caller_module_name)
file { /etc/redarrow.conf/$redarrow_file:
content =
template(${caller_module_name}/redarrow/${redarrow_file}.erb),
}
}
---
modules/mc/manifests/init.pp:

define mc::add_config($config) {
notice($caller_module_name)
file { /etc/douban/mc/$config:
content = template(${caller_module_name}/mc/${config}.erb),
}
}
---
modules/anduin/manifests/init.pp:

define anduin::set_up() {
mc::add_config { anduin memcache config file:
config = anduin-online
}

define anduin::add_up_anduin() {
redarrow::add_redarrow{ redarrow commands for anduin:
redarrow_file = anduin.conf
}
---
manifests/nodes.pp:

node 'faramir' inherits basenode {
anduin::add_up_anduin{ redarrow configs for up_anduin: }
}

node 'fili' inherits basenode {
anduin::set_up { New Broadcast Backend 1: }
}

The strange thing is, after starting puppet master, if you puppetrun
faramir first, then define anduin::add_up_anduin execute successfully,
the notice show $caller_module_name is anduin; But the followed define
anduin::set_up in node fili will be failed, the error report is: Can not
use a non-existent file for parsing at
/etc/puppet/modules/mc/manifests/init.pp:23 on node fili., and the notice
show that $caller_module_name is blank.

If you run node fili first, then anduin::set_up will be ok, but
anduin::add_up_anduin will be failed, report is: Can not use a
non-existent file for parsing at
/etc/puppet/modules/redarrow/manifests/init.pp:23 on node faramir.

Is this a bug or i have been making a mistake?

-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] can not use $caller_module_name

2011-03-08 Thread flex
I am so sorry to reply until now, yes, the notify and the
${caller_module_name} are also the right value, thank you very much!

2011/2/16 Felix Frank felix.fr...@alumni.tu-berlin.de

 Hi,

 have you tried adding 'notify { Caller module=$caller_module_name: }'
 to various classes/defines in the redarrow module?

 Also (although this is somewhat dumb), have you tried
 puppet:///modules/${caller_module_name}/redarrow.conf instead?
 Curly braces shouldn't be necessary there, but something definitely
 smells, so...

 Regards,
 Felix

 On 02/12/2011 06:06 PM, flex wrote:
  This is my puppet script:
 
  modules/redarrow/manifests/add.pp:
 
  define redarrow::add($type = file) {
  file { /etc/redarrow.conf/$name.conf:
  owner = root,
  group = root,
  mode = 644,
  source = $type ? {
  file =
 puppet:///modules/$caller_module_name/redarrow.conf,
  default = undef,
  },
  content = $type ? {
  template = template($caller_module_name/redarrow.erb),
  default = undef,
  },
  }
  }
 
  modules/portage/manifests/init.pp:
 
  redarrow::add {test_portage: }
 
  Result:
 
 (/Stage[main]/Portage/Redarrow::Add[test_portage]/File[/etc/redarrow.conf/test_portage.conf])
  Could not evaluate: Error 400 on SERVER: Invalid module name; module
  names must be alphanumeric (plus '-'), not 'redarrow.conf' Could not
  retrieve file metadata for puppet:///modules//redarrow.conf: Error 400
  on SERVER: Invalid module name; module names must be alphanumeric (plus
  '-'), not 'redarrow.conf' at
  /home/flex/puppet/modules/redarrow/manifests/add.pp:14
 
  It seems that the variable $caller_module_name is not set, then i found
  another stange thing, i got what i want like this:
 
  define redarrow::add($module = $name, $type = file) {
  file { /etc/redarrow.conf/$name.conf:
  owner = root,
  group = root,
  mode = 644,
  source = $type ? {
  file = puppet:///modules/$module/redarrow.conf,
  default = undef,
  },
  content = $type ? {
  template = template($module/redarrow.erb),
  default = undef,
  },
  }
  }
 
  the $name in varaible list of the define is not the same as the $name
  below which is the resource name, it is this a bug or a hidden feature?

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




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] can not use $caller_module_name

2011-02-12 Thread flex
This is my puppet script:

modules/redarrow/manifests/add.pp:

define redarrow::add($type = file) {
file { /etc/redarrow.conf/$name.conf:
owner = root,
group = root,
mode = 644,
source = $type ? {
file = puppet:///modules/$caller_module_name/redarrow.conf,
default = undef,
},
content = $type ? {
template = template($caller_module_name/redarrow.erb),
default = undef,
},
}
}

modules/portage/manifests/init.pp:

redarrow::add {test_portage: }

Result:
(/Stage[main]/Portage/Redarrow::Add[test_portage]/File[/etc/redarrow.conf/test_portage.conf])
Could not evaluate: Error 400 on SERVER: Invalid module name; module names
must be alphanumeric (plus '-'), not 'redarrow.conf' Could not retrieve file
metadata for puppet:///modules//redarrow.conf: Error 400 on SERVER: Invalid
module name; module names must be alphanumeric (plus '-'), not
'redarrow.conf' at /home/flex/puppet/modules/redarrow/manifests/add.pp:14

It seems that the variable $caller_module_name is not set, then i found
another stange thing, i got what i want like this:

define redarrow::add($module = $name, $type = file) {
file { /etc/redarrow.conf/$name.conf:
owner = root,
group = root,
mode = 644,
source = $type ? {
file = puppet:///modules/$module/redarrow.conf,
default = undef,
},
content = $type ? {
template = template($module/redarrow.erb),
default = undef,
},
}
}

the $name in varaible list of the define is not the same as the $name below
which is the resource name, it is this a bug or a hidden feature?

-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] can not use $caller_module_name

2011-02-12 Thread flex
my puppet version is 2.6.2

2011/2/13 Nan Liu n...@puppetlabs.com

 On Sat, Feb 12, 2011 at 9:06 AM, flex frostyn...@gmail.com wrote:
  This is my puppet script:
  modules/redarrow/manifests/add.pp:
  define redarrow::add($type = file) {
  file { /etc/redarrow.conf/$name.conf:
  owner = root,
  group = root,
  mode = 644,
  source = $type ? {
  file =
 puppet:///modules/$caller_module_name/redarrow.conf,
  default = undef,
  },
  content = $type ? {
  template = template($caller_module_name/redarrow.erb),
  default = undef,
  },
  }
  }
  modules/portage/manifests/init.pp:
  redarrow::add {test_portage: }
  Result:
 
 (/Stage[main]/Portage/Redarrow::Add[test_portage]/File[/etc/redarrow.conf/test_portage.conf])
  Could not evaluate: Error 400 on SERVER: Invalid module name; module
 names
  must be alphanumeric (plus '-'), not 'redarrow.conf' Could not retrieve
 file
  metadata for puppet:///modules//redarrow.conf: Error 400 on SERVER:
 Invalid
  module name; module names must be alphanumeric (plus '-'), not
  'redarrow.conf' at /home/flex/puppet/modules/redarrow/manifests/add.pp:14

 What version of puppet are you using? This is limited to 2.6.x.

  It seems that the variable $caller_module_name is not set, then i found
  another stange thing, i got what i want like this:
  define redarrow::add($module = $name, $type = file) {
  file { /etc/redarrow.conf/$name.conf:
  owner = root,
  group = root,
  mode = 644,
  source = $type ? {
  file = puppet:///modules/$module/redarrow.conf,
  default = undef,
  },
  content = $type ? {
  template = template($module/redarrow.erb),
  default = undef,
  },
  }
  }
  the $name in varaible list of the define is not the same as the $name
 below
  which is the resource name, it is this a bug or a hidden feature?

 $name is in scope within {..}. However this is fixed in 5061 which
 will be released in 2.6.5 (currently rc2):
 http://projects.puppetlabs.com/issues/5061

 Thanks,

 Nan

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




-- 
System Administrator, Focus on System Management and Basic Development

-- 
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] can not use $caller_module_name

2011-02-12 Thread flex
by the way, the $module_name is set correctly, but seems it can not be pass
to a define like this:

redarrow::add {test_portage: module = $module_name}


2011/2/13 flex frostyn...@gmail.com

 my puppet version is 2.6.2

 2011/2/13 Nan Liu n...@puppetlabs.com

 On Sat, Feb 12, 2011 at 9:06 AM, flex frostyn...@gmail.com wrote:
  This is my puppet script:
  modules/redarrow/manifests/add.pp:
  define redarrow::add($type = file) {
  file { /etc/redarrow.conf/$name.conf:
  owner = root,
  group = root,
  mode = 644,
  source = $type ? {
  file =
 puppet:///modules/$caller_module_name/redarrow.conf,
  default = undef,
  },
  content = $type ? {
  template = template($caller_module_name/redarrow.erb),
  default = undef,
  },
  }
  }
  modules/portage/manifests/init.pp:
  redarrow::add {test_portage: }
  Result:
 
 (/Stage[main]/Portage/Redarrow::Add[test_portage]/File[/etc/redarrow.conf/test_portage.conf])
  Could not evaluate: Error 400 on SERVER: Invalid module name; module
 names
  must be alphanumeric (plus '-'), not 'redarrow.conf' Could not retrieve
 file
  metadata for puppet:///modules//redarrow.conf: Error 400 on SERVER:
 Invalid
  module name; module names must be alphanumeric (plus '-'), not
  'redarrow.conf' at
 /home/flex/puppet/modules/redarrow/manifests/add.pp:14

 What version of puppet are you using? This is limited to 2.6.x.

  It seems that the variable $caller_module_name is not set, then i found
  another stange thing, i got what i want like this:
  define redarrow::add($module = $name, $type = file) {
  file { /etc/redarrow.conf/$name.conf:
  owner = root,
  group = root,
  mode = 644,
  source = $type ? {
  file = puppet:///modules/$module/redarrow.conf,
  default = undef,
  },
  content = $type ? {
  template = template($module/redarrow.erb),
  default = undef,
  },
  }
  }
  the $name in varaible list of the define is not the same as the $name
 below
  which is the resource name, it is this a bug or a hidden feature?

 $name is in scope within {..}. However this is fixed in 5061 which
 will be released in 2.6.5 (currently rc2):
 http://projects.puppetlabs.com/issues/5061

 Thanks,

 Nan

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




 --
 System Administrator, Focus on System Management and Basic Development




-- 
System Administrator, Focus on System Management and Basic Development

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