Trevor Vaughan wrote:
Ok, so I'm not sure how this proposal will go over but I'm going to
throw it out there.

I recently encountered a situation where I was using the stdlib function
'file_line' to manage one line in a file but, through various means,
ended up managing the entire file when using the code base i a different
way.

What I would like to propose is the addition of two metaparameters to
correlate with the code smell of defined().

I hate defined() because it's code order dependent. So, I would like to
add is_active and is_inactive as metaparameters that use the actual
catalog state to determine whether or not to run the resource.

Example:

file { '/tmp/foo': content => "foo\nbar" }
file_line { 'test':
   path => '/tmp/foo',
   line => 'foo'
}

As you can see from this contrived example, these two resources will
constantly fight.

However, if we do the following:

file { '/tmp/foo': content => "foo\nbar" }
file_line { 'test':
   path => 'tmp/foo',
   line => 'foo',
   is_inactive => File['/tmp/foo']
}

Then, file_line will only execute if the File['/tmp/foo'] resource is
not in the catalog. Otherwise, it should just log a debug message that
it is not executing due to the is_inactive metaparameter.

Hi Trevor,

I think that's an interesting idea. Is the case of conflicting resources the only one you would expect to use this, or are there other use cases? If this is the main use case, I'd recommend names that better indicate a conflict or the need for exclusivity.

For this case, though, I actually prefer the idea of finding a way for the system to detect conflicts between whole-file methods and the per-record methods. I know that's not a great short-term fix, and I do think it's past time we added some kind of catalog control like this into the system.

--
Luke Kanies | http://about.me/lak | http://puppetlabs.com/ | +1-615-594-8199

--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-dev.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to