Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-5691

Allow `tidy` type to delete "all except N"

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:

      Description

      I'm currently working on producing a capistrano-style layout with only puppet, specifically I'm working on the bit where I want to keep the last few releases around on disk so they can easily be rolled back to.

      I've been able to use the tidy type to decent effect here, keeping anything from the last week or so. Ideally I'd actually want to say "keep N" - and have everything except the latest N items be deleted.

      This could look something like:

        tidy { '/srv/app/releases':
          rmdirs => true,
          recurse => 1,
          age => '5m',
          keep => 3,
          type => 'mtime',
        }
      

      The rough implementation would be to do what tidy does already, but after filtering down to the items that need deleting it would sort by the type field ascending and then drop the first N items before proceeding.

      If this is deemed a reasonable proposal I'm happy to try and contribute a PR - it seems like it should be simple enough.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            glenjamin Glen Mailer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support