Hi, I would like to use a define for files, for example: define afile($owner = root, $group = root, $mode, $src, $backup = false, $recurse = false) { file {"$name": recurse => $recurse, mode => $mode, owner => $owner, group => $group, backup => $backup, sourceselect => first, source => [ "puppet://$servername/$modulename/$factA/$src", "puppet://$servername/$modulename/$factB/$src", ] } } However, I cant use it as I dont have the $modulename as a variable. 1. how hard would it be to have the relevant module name as a variable (instead of putting in the top of each module $modulename=''name''). 2. is there any other/better way to handle it? Thanks, Ohad --~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On May 29, 2008, at 8:35 PM, Ohad Levy wrote:> However, I cant use it as I dont have the $modulename as a variable. > 1. how hard would it be to have the relevant module name as a > variable (instead of putting in the top of each module > $modulename=''name''). > 2. is there any other/better way to handle it?Would you want $modulename to refer to the module in which ''afile'' is defined, or in which it''s used? Either way, it wouldn''t be all that much work, but it might require a bit of trickery. That is, I think it would be little code but not necessarily easy code. -- A little government and a little luck are necessary in life, but only a fool trusts either of them. -- P. J. O''Rourke --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Well, I would like to use the one which is being called from, i.e. that whenever i use the afile define it will fetch the file from the right module. I''m willing to try to implement it, if you can give me some hints :) Thanks, Ohad On Fri, May 30, 2008 at 9:47 AM, Luke Kanies <luke@madstop.com> wrote:> > On May 29, 2008, at 8:35 PM, Ohad Levy wrote: > > > However, I cant use it as I dont have the $modulename as a variable. > > 1. how hard would it be to have the relevant module name as a > > variable (instead of putting in the top of each module > > $modulename=''name''). > > 2. is there any other/better way to handle it? > > > Would you want $modulename to refer to the module in which ''afile'' is > defined, or in which it''s used? > > Either way, it wouldn''t be all that much work, but it might require a > bit of trickery. That is, I think it would be little code but not > necessarily easy code. > > -- > A little government and a little luck are necessary in life, but only a > fool trusts either of them. -- P. J. O''Rourke > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On May 29, 2008, at 9:11 PM, Ohad Levy wrote:> Well, I would like to use the one which is being called from, i.e. > that whenever i use the afile define it will fetch the file from the > right module.Ok.> > I''m willing to try to implement it, if you can give me some hints :)I''m not sure exactly. I guess that you could look at the ast/ definition.rb file, and see whether just setting $modulename to the first field in the ''classname'' variable works. This would be slightly hackish, in that classes named ''one::two'' or even just ''one'' would get their modulename set to ''one'', even if they aren''t in a module, but it''s certainly the easiest solution. Other than that, you''d need to find some way to connect the parser, modules, and I guess the same AST files. -- SCSI is *not* magic. There are fundamental technical reasons why it is necessary to sacrifice a young goat to your SCSI chain now and then. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On Fri, May 30, 2008 at 1:42 PM, Luke Kanies <luke@madstop.com> wrote:> > On May 29, 2008, at 9:11 PM, Ohad Levy wrote: > > > Well, I would like to use the one which is being called from, i.e. > > that whenever i use the afile define it will fetch the file from the > > right module. > > Ok. > > > > > I''m willing to try to implement it, if you can give me some hints :) > > > I''m not sure exactly. I guess that you could look at the ast/ > definition.rb file, and see whether just setting $modulename to the > first field in the ''classname'' variable works. > > This would be slightly hackish, in that classes named ''one::two'' or > even just ''one'' would get their modulename set to ''one'', even if they > aren''t in a module, but it''s certainly the easiest solution. >Thats easy enough, but I can''t find how to make the variable available in the puppet manifest.> > Other than that, you''d need to find some way to connect the parser, > modules, and I guess the same AST files. >where can I find more information about puppet internals?> > -- > SCSI is *not* magic. There are fundamental technical reasons > why it is necessary to sacrifice a young goat to your SCSI chain > now and then. > --------------------------------------------------------------------- > Luke Kanies | http://reductivelabs.com | http://madstop.com > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On May 30, 2008, at 1:55 AM, Ohad Levy wrote:> > On Fri, May 30, 2008 at 1:42 PM, Luke Kanies <luke@madstop.com> wrote: > > On May 29, 2008, at 9:11 PM, Ohad Levy wrote: > > I''m not sure exactly. I guess that you could look at the ast/ > definition.rb file, and see whether just setting $modulename to the > first field in the ''classname'' variable works. > > This would be slightly hackish, in that classes named ''one::two'' or > even just ''one'' would get their modulename set to ''one'', even if they > aren''t in a module, but it''s certainly the easiest solution.> > Thats easy enough, but I can''t find how to make the variable > available in the puppet manifest.See the ''set_resource_parameters'' method in the parser/ast/ definition.rb file.> Other than that, you''d need to find some way to connect the parser, > modules, and I guess the same AST files. > where can I find more information about puppet internals?At this point, mostly be reading the code. I haven''t attempted to maintain documentation on the internals for a while. I guess it might help a bit to look through the rdocs: http://reductivelabs.com/downloads/puppet/apidocs/ But no guarantees that''s of any use. -- A little government and a little luck are necessary in life, but only a fool trusts either of them. -- P. J. O''Rourke --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---