/puppet-resource_api

This library provides a simple way to write new native resources for https://puppet.com.

Primary LanguageRubyApache License 2.0Apache-2.0

Puppet::ResourceApi TravisCI Build Status Appveyor Build status

codecov

This is an implementation of the Resource API proposal. Find a working example of a new-style provider in the experimental puppetlabs-apt branch. There is also the corresponding type, provider, and new unit tests for 100% coverage.

Installation

Add this line to your application's Gemfile:

gem 'puppet-resource_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install puppet-resource_api

Usage

The Resource API explains the usage and capabilities of this gem.

Already working:

  • basic type and provider definition, using name, desc, and attributes
  • the canonicalize and remote_resource features
  • all the logging facilities
  • executing the new provider under any of the following commands:
    • puppet apply
    • puppet resource
    • puppet agent
    • puppet device (if applicable)

There are still a few notable gaps between the implementation, and the specification:

  • Only a single runtime environment (the puppet commands) is currently implemented.
  • auto* definitions
  • the Commands API is mostly implemented, but deployment is blocked on upstream work (PDK-580). You can use regular Ruby system() calls as a workaround, with all their attendant encoding, and safety issues.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/puppet-resource_api.