Sha256: 2ccf8545f83267b581d5c1bb31a69a0d62b739405d5a59f94f1fe6c55059debc

Contents?: true

Size: 1.2 KB

Versions: 20

Compression:

Stored size: 1.2 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]' : should
        case @resource["withpath"]
        when :true
          send(@resource[:loglevel], message)
        else
          Puppet.send(@resource[:loglevel], message)
        end
        nil
      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

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.10.0 lib/puppet/type/notify.rb
puppet-8.10.0-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.10.0-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.10.0-universal-darwin lib/puppet/type/notify.rb
puppet-8.9.0 lib/puppet/type/notify.rb
puppet-8.9.0-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.9.0-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.9.0-universal-darwin lib/puppet/type/notify.rb
puppet-8.8.1 lib/puppet/type/notify.rb
puppet-8.8.1-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.8.1-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.8.1-universal-darwin lib/puppet/type/notify.rb
puppet-8.7.0 lib/puppet/type/notify.rb
puppet-8.7.0-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.7.0-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.7.0-universal-darwin lib/puppet/type/notify.rb
puppet-8.6.0 lib/puppet/type/notify.rb
puppet-8.6.0-x86-mingw32 lib/puppet/type/notify.rb
puppet-8.6.0-x64-mingw32 lib/puppet/type/notify.rb
puppet-8.6.0-universal-darwin lib/puppet/type/notify.rb