File: device_provider.rb

package info (click to toggle)
ruby-puppet-resource-api 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,232 kB
  • sloc: ruby: 9,573; sh: 4; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require 'puppet/resource_api'

# A example/test provider for Device support
class Puppet::Provider::DeviceProvider::DeviceProvider
  def get(_context)
    [{ name: 'wibble', ensure: 'present', string: 'sample', string_ro: 'fixed' }]
  end

  def set(context, changes); end

  def canonicalize(_context, resources)
    if resources[0][:name] == 'wibble'
      resources[0][:string] = 'changed'
    end
    resources
  end
end