Issue #9112 has been updated by Trevor Vaughan.

Priority changed from High to Urgent

I was finally able to pin this down a bit more and there is a definitely 
serious issue with the combination of file and tidy.

Pre-Setup:

/root/foo
/root/foo/blah1
/root/foo/blah2
/root/foo/blah3

Example Code:

<pre>
tidy { "/root/bar":
  size => '0b',
  matches => '*',
  recurse => 'true'
}

file { "/root/bar":
  ensure => 'directory',
  source => 'file:///root/foo',
  recurse => 'true'
}

file { "/root/bar/test3":
  ensure => 'file',
  content => 'blah'
}
</pre>

After creating this code and running it once with 'puppet apply', remove the 
file 'blah2' from the directory 'bar' and run 'puppet apply' again.

With subsequent runs of puppet, it will remove random files from 'bar' and 
create random other ones. This causes extremely non-deterministic behaviour.

However, this does not always manifest itself. It appears to only happen when a 
file that is usually there gets removed by some other means. However, I think 
that it's related to the 'duplicate generated resource' material above even 
though this code doesn't spawn that warning.

The use case for doing something like this is to ensure that the only files in 
a directory are those placed by puppet. I know that this can be done using 
'file' with 'purge', but this did not always work properly in legacy versions 
of puppet and the presented combination should either throw an error or work in 
a deterministic manner.
----------------------------------------
Bug #9112: "Duplicate generated resource; skipping" when using Tidy with File.
https://projects.puppetlabs.com/issues/9112

Author: Trevor Vaughan
Status: Accepted
Priority: Urgent
Assignee: Daniel Pittman
Category: file
Target version: 
Affected Puppet version: 2.7.7rc2
Keywords: tidy, file, duplicate resource
Branch: 


The following code produces the 'info' statement "Duplicate generated resource; 
skipping" when run under 'puppet agent'. 'puppet apply' does not appear to have 
the same issue.

<pre>
file { '/tmp/foo':
  ensure => 'directory',
  mode => '644'
}

file { [
  '/tmp/foo/bar',
  '/tmp/foo/bar1',
  '/tmp/foo/bar2'
  ]:
  ensure => 'file',
  owner => 'root',
  group => 'root',
  mode => '644',
  content => "test\n"
}

exec { 'make_baz':
  command => '/bin/echo "test" > /tmp/foo/baz',
  require => File['/tmp/foo']
}

tidy { '/tmp/foo':
  size => '0b',
  recurse => 'true',
  rmdirs => 'true'
}
</pre>

Output:

<pre>
notice: /Stage[main]//Node[test.test.net]/Tidy[/tmp/foo]: Tidying File[/tmp/foo]
notice: /Stage[main]//Node[test.test.net]/Tidy[/tmp/foo]: Tidying 
File[/tmp/foo/bar1]
notice: /Stage[main]//Node[test.test.net]/Tidy[/tmp/foo]: Tidying 
File[/tmp/foo/baz]
notice: /Stage[main]//Node[test.test.net]/Tidy[/tmp/foo]: Tidying 
File[/tmp/foo/bar]
notice: /Stage[main]//Node[test.test.net]/Tidy[/tmp/foo]: Tidying 
File[/tmp/foo/bar2]
info: /File[/tmp/foo/bar2]: Duplicate generated resource; skipping
info: /File[/tmp/foo/bar1]: Duplicate generated resource; skipping
info: /File[/tmp/foo/bar]: Duplicate generated resource; skipping
info: /File[/tmp/foo]: Duplicate generated resource; skipping
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to