Sha256: e3c08a9b37715415524bcef06cc86287118b20caa38ab18893aba228231adc20

Contents?: true

Size: 1.21 KB

Versions: 12

Compression:

Stored size: 1.21 KB

Contents

# frozen_string_literal: true

#
# Simple module for logging messages on the client-side

module Puppet
  Type.newtype(:notify) do
    @doc = "Sends an arbitrary message, specified as a string, to the agent run-time log. It's important to note that the notify resource type is not idempotent. As a result, notifications are shown as a change on every Puppet run."

    apply_to_all

    newproperty(:message, :idempotent => false) do
      desc "The message to be sent to the log. Note that the value specified must be a string."
      def sync
        message = @sensitive ? 'Sensitive [value redacted]' : self.should
        case @resource["withpath"]
        when :true
          send(@resource[:loglevel], message)
        else
          Puppet.send(@resource[:loglevel], message)
        end
        return
      end

      def retrieve
        :absent
      end

      def insync?(is)
        false
      end

      defaultto { @resource[:name] }
    end

    newparam(:withpath) do
      desc "Whether to show the full object path."
      defaultto :false

      newvalues(:true, :false)
    end

    newparam(:name) do
      desc "An arbitrary tag for your own reference; the name of the message."
      isnamevar
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
puppet-8.5.1 lib/puppet/type/notify.rb
puppet-8.5.1-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.5.1-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.5.1-universal-darwin lib/puppet/type/notify.rb
puppet-8.5.0 lib/puppet/type/notify.rb
puppet-8.5.0-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.5.0-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.5.0-universal-darwin lib/puppet/type/notify.rb
puppet-8.4.0 lib/puppet/type/notify.rb
puppet-8.4.0-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.4.0-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.4.0-universal-darwin lib/puppet/type/notify.rb