Bug #2220

Empty Directories and Purging not behaving well

Added by R.I. Pienaar almost 3 years ago. Updated over 2 years ago.

Status:Closed Start date:05/04/2009
Priority:Normal Due date:
Assignee:James Turnbull % Done:

0%

Category:file
Target version:0.25.0
Affected Puppet version:0.25.0 Branch:
Keywords:
Votes: 0

Description

Using the kind of technique as documented here: http://reductivelabs.com/trac/puppet/wiki/FrequentlyAskedQuestions#i-want-to-manage-a-directory-and-purge-its-contents

I am seeing some regression with 0.25.0:

Manifest:

        File{   
                owner           => "root",
                group           => "root",
                mode            => "0644",
        }


        file{"/tmp/special.d/snippets/00_snippet":
                content         => "Hello World\n"
        }

        file{"/tmp/special.d":
                ensure  => directory,
        }

        file{"/tmp/special.d/snippets":
                ensure          => directory,
                source          => "puppet://puppet/modules/puppet/empty",
                recurse         => true,
                purge           => true,
                force           => true,
                ignore          => ".svn",
        }

The first run works well, does what you’d expect:

info: Caching catalog for dev1.mydev.net
notice: //Node[dev1.mydev.net]/File[/tmp/special.d]/ensure: created
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets]/ensure: created
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/checksum: defined 'checksum' as '{md5}e59ff97941044f85df5297e1c302d260'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/content: defined 'content' as '{md5}e59ff97941044f85df5297e1c302d260'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/owner: defined 'owner' as 'root'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/group: defined 'group' as 'root'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/mode: defined 'mode' as '644'
notice: Finished catalog run in 0.25 seconds

Subsequent runs does this though:

info: Caching catalog for dev1.mydev.net
notice: //Node[dev1.mydev.net]/File[/tmp/special.d]/mode: mode changed '644' to '755'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets]/checksum: checksum changed '{mtime}Mon May 04 14:34:59 +0100 2009' to '{mtime}Mon May 04 14:39:18 +0100 2009'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets]/mode: mode changed '644' to '755'
notice: /File[/tmp/special.d/snippets/00_snippet]/ensure: removed
warning: Got an event from invalid vertex File[/tmp/special.d/snippets/00_snippet]
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/checksum: defined 'checksum' as '{md5}e59ff97941044f85df5297e1c302d260'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/content: defined 'content' as '{md5}e59ff97941044f85df5297e1c302d260'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/owner: defined 'owner' as 'root'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/group: defined 'group' as 'root'
notice: //Node[dev1.mydev.net]/File[/tmp/special.d/snippets/00_snippet]/mode: defined 'mode' as '644'
notice: Finished catalog run in 0.25 seconds

There are a few problems here:

Shouldn’t it be leaving the directory modes alone? 0.24.x did the right thing and changed the modes for directories as you’d expect and didn’t in future runs try to fiddle with them

It then removes the File[/tmp/special.d/snippets/00_snippet] resource and creates it again

This isn’t right and is a big regression from 0.24.x for anyone who use snippets to construct files etc.

History

Updated by James Turnbull almost 3 years ago

  • Category set to file
  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Luke Kanies
  • Target version set to 0.25.0
  • Affected Puppet version changed from 0.24.7 to 0.25.0

Updated by Luke Kanies almost 3 years ago

  • Status changed from Needs Decision to Accepted

Updated by Brice Figureau over 2 years ago

  • Assignee changed from Luke Kanies to Brice Figureau

I’m taking ownership of this issue. I think it is a caching issue in the File type, i.e. we cache the ‘stat’ too much and then we’re confused…

Updated by Brice Figureau over 2 years ago

  • Status changed from Accepted to Ready For Checkin
  • Assignee changed from Brice Figureau to James Turnbull

Luke somewhat approved the patch. I think you can merge it.

The patch is available in my github repository, branch tickets/master/2220: http://github.com/masterzen/puppet/tree/tickets/master/2220

Updated by James Turnbull over 2 years ago

  • Status changed from Ready For Checkin to Closed

Pushed in commit:d7be0333ae1fc03bb5b639e7ab8f5431b56d1071 in branch master.

Also available in: Atom PDF