Robert Nickel
2007-Feb-01 00:02 UTC
Interesting interaction between source and ensure in file definition in function...
Given the following: file { "/my/file": source => "puppet://server/path/to/some/file", ensure => absent } Puppet will copy /my/file to the host. What I was hoping was that ensure => absent would trump a source file. However, if we change the above slightly like this: file { "/my/file": source => "puppet://server/no/such/file", ensure => absent } Puppet complains that it can''t find /no/such/file and then enforces the ensure by deleting the file. Is this by design, a side effect of the function or just a property of the file type? Thanks, --Robert
Luke Kanies
2007-Feb-01 00:34 UTC
Re: Interesting interaction between source and ensure in file definition in function...
On Jan 31, 2007, at 6:02 PM, Robert Nickel wrote:> > Is this by design, a side effect of the function or just a property > of the > file type?This is a bug, is now fixed, and will work in the next release, which is imminent. Thanks. -- A Chemical Limerick: A mosquito cried out in pain: "A chemist has poisoned my brain!" The cause of his sorrow was para-dichloro diphenyltrichloroethane -- Dr. D. D. Perrin --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Robert Nickel
2007-Feb-01 00:43 UTC
Re: Interesting interaction between source and ensure in file definition in function...
On 2007.01.31 18:34:46 +0000, Luke Kanies wrote:> On Jan 31, 2007, at 6:02 PM, Robert Nickel wrote: > > > > Is this by design, a side effect of the function or just a property > > of the > > file type? > > This is a bug, is now fixed, and will work in the next release, which > is imminent.Excellent news. What is the defined behavior when both ensure and source are specified? --Robert
Luke Kanies
2007-Feb-01 00:59 UTC
Re: Interesting interaction between source and ensure in file definition in function...
On Jan 31, 2007, at 6:43 PM, Robert Nickel wrote:> > Excellent news. > > What is the defined behavior when both ensure and source are > specified?Ensure beats source. The problem was that the source parameter sets ''ensure'', so it was replacing the ''ensure'' setting. BTW, the email address you''re using is not subscribed to the list; I''ve been having to explicitly allow your posts. -- Yesterday upon the stair I met a man who wasn''t there. He wasn''t there again today -- I think he''s from the CIA. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Digant C Kasundra
2007-Feb-01 01:03 UTC
Re: Interesting interaction between source and ensure in file definition in function...
--On Wednesday, January 31, 2007 4:02 PM -0800 Robert Nickel <rnickel@scea.com> wrote:> Given the following: > > > file { "/my/file": > source => "puppet://server/path/to/some/file", > ensure => absent > } > > Puppet will copy /my/file to the host.Out of curiosity, why would you want to do that? -- Digant C Kasundra <digant@stanford.edu> Technical Lead, ITS Unix Systems and Applications, Stanford University
Robert Nickel
2007-Feb-01 01:30 UTC
Re: Interesting interaction between source and ensure in file definition in function...
On 2007.01.31 17:03:21 +0000, Digant C Kasundra wrote:> --On Wednesday, January 31, 2007 4:02 PM -0800 Robert Nickel > <rnickel@scea.com> wrote: > > > Given the following: > > > > > > file { "/my/file": > > source => "puppet://server/path/to/some/file", > > ensure => absent > > } > > > > Puppet will copy /my/file to the host. > > Out of curiosity, why would you want to do that?It''s a side effect of a function defined that''s similar to remotefile. The function is used in a base class to define all files that can possibly exist for that base class. When a sub-class is created that doesn''t need the file in question, the file''s ensure method is overridden to erase the unwanted file. I''ll type up a config example if it''s desired but won''t spam the list otherwise. --Robert p.s. I think mutt will now make my list issues go away.