I added some text to http://reductivelabs.com/trac/puppet/wiki/FunctionReference. It explains that functions get evaluated at compile time, before execution time, and that this matters if you''re using functions whose values depend on the results of your manifests. http://reductivelabs.com/trac/puppet/wiki/FunctionReference?action=diff&version=26&old_version=25 I''d appreciate it if someone would check the accuracy of what I wrote, and if it''s deemed to be accurate and useful, apply it upstream so that it will stay in the wiki. Thanks, Andrew. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to puppet-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 08.12.2009 11:31, Andrew Schulman wrote:> I added some text to > http://reductivelabs.com/trac/puppet/wiki/FunctionReference. It explains that > functions get evaluated at compile time, before execution time, and that this > matters if you''re using functions whose values depend on the results of your > manifests. > > http://reductivelabs.com/trac/puppet/wiki/FunctionReference?action=diff&version=26&old_version=25 > > I''d appreciate it if someone would check the accuracy of what I wrote, and if > it''s deemed to be accurate and useful, apply it upstream so that it will stay in > the wiki.Not quite: The functions are actually evaluated on the server. You example of using file($path) and file { $path: ... } will never work, since the file() function will read $path on the puppetmaster, while the File[$path] resource will manage $path on the client. Regards, DavidS -- 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.
> I''d appreciate it if someone would check the accuracy of what I wrote, and if > it''s deemed to be accurate and useful, apply it upstream so that it > will stay in > the wiki.hmm, I''m not sure whether it is now even more misleading than before. The point with function is that they are evaluated at compile time and as compilation happens on the master it will also only see things on the master. So your example is so far only working if you either run puppet as standalone app or you are talking about a file resource which will get applied on the master. Everything else won''t work. In general your explanation is correct, but I think maybe it is misleading for some people, as many people don''t understand at first why functions are only evaluated on the master. I think it''s good to extend the function explanation, there is also some part in the language tutorial: http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#functions Maybe we should simply put the warning in the FunctionReference as well and redirect for further information to the LanguageTutorial where people can extend the documentation how they would like to extend it. So imho your explanation would fit better there. thanks and cheers pete -- 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.
Andrew Schulman
2009-Dec-08 11:09 UTC
Re: [Puppet Users] addition to wiki/FunctionReference
> On 08.12.2009 11:31, Andrew Schulman wrote: > > I added some text to > > http://reductivelabs.com/trac/puppet/wiki/FunctionReference. It explains that > > functions get evaluated at compile time, before execution time, and that this > > matters if you''re using functions whose values depend on the results of your > > manifests. > > > > http://reductivelabs.com/trac/puppet/wiki/FunctionReference?action=diff&version=26&old_version=25 > > > > I''d appreciate it if someone would check the accuracy of what I wrote, and if > > it''s deemed to be accurate and useful, apply it upstream so that it will stay in > > the wiki. > > > Not quite: The functions are actually evaluated on the server. You > example of using file($path) and file { $path: ... } will never work, > since the file() function will read $path on the puppetmaster, while the > File[$path] resource will manage $path on the client.Well, not never. It works if it''s run on the puppetmaster, which is the case I actually was thinking of and where I first encountered the problem. It''s also the case if you run a puppet script standalone with /usr/bin/puppet. But you''re right of course that the statement needs to be make clear that functions are evaluated on the puppetmaster. I''ll think on that. Thanks, Andrew. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to puppet-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Andrew Schulman
2009-Dec-08 11:15 UTC
Re: [Puppet Users] addition to wiki/FunctionReference
> > I''d appreciate it if someone would check the accuracy of what I wrote, and if > > it''s deemed to be accurate and useful, apply it upstream so that it > > will stay in > > the wiki. > > hmm, I''m not sure whether it is now even more misleading than before. > The point with function is that they are evaluated at compile time and > as compilation happens on the master it will also only see things on > the master. > So your example is so far only working if you either run puppet as > standalone app or you are talking about a file resource which will get > applied on the master. > Everything else won''t work. > In general your explanation is correct, but I think maybe it is > misleading for some people, as many people don''t understand at first > why functions are only evaluated on the master.Agreed-- see my answer to David. I''ve backed it out for now and will rework it.> I think it''s good to extend the function explanation, there is also > some part in the language tutorial: > http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#functions > Maybe we should simply put the warning in the FunctionReference as > well and redirect for further information to the LanguageTutorial > where people can extend the documentation how they would like to > extend it. > So imho your explanation would fit better there.To me it seems like more specialized material that should go in the reference rather than the tutorial. But wherever it goes best is fine with me. Thanks for your comments. Andrew. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to puppet-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
James Turnbull
2009-Dec-08 11:49 UTC
Re: [Puppet Users] addition to wiki/FunctionReference
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andrew I don''t know your background but have you considered cloning the git repo and directly editing the reference source and submitting patches? That way it''s straight upstream and you get credit for the update. You can find some instructions at: http://reductivelabs.com/trac/puppet/wiki/Development/DevelopmentLifecycle Cheers James Turnbull - -- Author of: * Pro Linux System Administration (http://tinyurl.com/linuxadmin) * Pulling Strings with Puppet (http://tinyurl.com/pupbook) * Pro Nagios 2.0 (http://tinyurl.com/pronagios) * Hardening Linux (http://tinyurl.com/hardeninglinux) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEVAwUBSx49XiFa/lDkFHAyAQKiBAgAov6VP0SNg3DqpF2I2lFQjcyPHc8Z1ITu w1GahuFuK83BhxjpZaCtznJrMAcAYqDRZ58rRjqF7tQ9iXoee2UfZuHFfSvdgPtw kvJCKIehvxrku18nlWNdw9ECgWO4crrFMbmdoMQ8zu5Ww0/NwKtTA/1r0kgjycA0 ER26TDyL1RdIyBLuoOnmQYN6hhIFKicEnJ35Gv/Ihou9cMSKOpRt/LxznGaVuxkE bLbgWLt4uOuwUMkVYtKhuZ5CimSBvm2ZCRKEUWXeDLe2huI+KWJS06E238AChPYk UqS20AVJL7qlkjW25945ZbzwlAsmwYfMuvvtW7srNSwQMA9WQIvUBg==UWN9 -----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-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.
Andrew Schulman
2009-Dec-08 13:31 UTC
Re: [Puppet Users] addition to wiki/FunctionReference
> I don''t know your background but have you considered cloning the git > repo and directly editing the reference source and submitting > patches? That way it''s straight upstream and you get credit for the > update. > > You can find some instructions at: > > http://reductivelabs.com/trac/puppet/wiki/Development/DevelopmentLifecycleThanks. I''m a bzr guy, but I''ll see about getting up to speed with git. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to puppet-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thomas Bellman
2009-Dec-09 10:36 UTC
Re: [Puppet Users] addition to wiki/FunctionReference
Andrew Schulman wrote:> To me it seems like more specialized material that should go in the reference > rather than the tutorial. But wherever it goes best is fine with me.Well, the Language Tutorial *is* the reference manual for the language. There''s no other document giving a more in-depth description of how the Puppet language works. (At least I haven''t seen any.) /Bellman -- 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.