File: policy_rcd.rb

package info (click to toggle)
puppet-module-openstacklib 17.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 768 kB
  • sloc: ruby: 3,858; python: 37; sh: 21; makefile: 10
file content (21 lines) | stat: -rw-r--r-- 587 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Puppet::Type.newtype(:policy_rcd) do
  ensurable

  newparam(:name, :namevar => true) do
    newvalues(/\S+/)
  end

  newproperty(:service) do
    defaultto { @resource[:name] }
    newvalues(/\S+/)
  end

  newproperty(:set_code) do
    defaultto('101')
    validate do |value|
      # validate codes according to https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt
      allowed_codes = [ '0', '1', '100', '101', '102', '103', '104', '105', '106' ]
      raise ArgumentError, 'Unknown exit status code is set' unless allowed_codes.include?(value)
    end
  end
end