Introducing the Deprecate function

A fair while ago I wrote a Deprecation Warnings From Puppet Resources blog post and metaparameter for adding expiry information to your manifests -

  file { '/ec/cron.d/remove_foos':
    ensure      => 'file',
    source      => 'puppet:///modules/foo/foo.cron',
    # our custom metaparameter
    deprecation => '20130425:Release 6 removes the need for the foo cronjob',
  }

We were happy users of this for a while but it had a high cost, we had to maintain our own puppet fork due to puppet being unable to load metaparams from modules. In the new world of Puppet 4 and all in one packages, and the lack of any action on that ticket, I’ve rewritten the code to live in a function that can deployed via a module and so no longer needs a custom fork.

  class deprecated_resources {

    # show a warning in puppetservers log
    deprecate('2015-01-20', 'Remove Foo at the end of the contract')

    # fail the run and show a warning clients output and masters logfile
    deprecate('2015-01-25', 'Remove Foo at the end of the contract', true)

  }

The Puppet deprecate function (and on the Puppet Forge) isn’t quite as nice as the metaparameter. It’s more free floating and less directly applied to an individual resource. It’s also run server side so you only see any warnings on the client when you set abort to true. Still, even with these drawbacks it’s a useful little function and it allows us to move back to upstream supplied packages. Well, once we rewrite a few other things too.