File: is_service_default.rb

package info (click to toggle)
puppet-module-openstacklib 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 956 kB
  • sloc: ruby: 4,549; python: 33; sh: 22; makefile: 10
file content (20 lines) | stat: -rw-r--r-- 660 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This function can be used to check if a variable is set to the default value
# of '<SERVICE DEFAULT>'
#
# For reference:
# http://lists.openstack.org/pipermail/openstack-dev/2015-July/069823.html
# https://github.com/openstack/puppet-openstacklib/commit/3b85306d042292713d0fd89fa508e0a0fbf99671
Puppet::Functions.create_function(:is_service_default) do
  def is_service_default(*args)
    raise(Puppet::ParseError, "is_service_default(): Wrong number of arguments" +
          "given (#{args.size} for 1)") if args.size != 1

    value = args[0]

    unless value.is_a?(String)
      return false
    end

    return (value == '<SERVICE DEFAULT>')
  end
end