aboutsummaryrefslogtreecommitdiff
path: root/modules/base_installation/lib/puppet/type/notify_refresh.rb
blob: 35f0cda43ee1659b41594c3417aff087209f4e14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# Simple module for logging messages on the client-side


module Puppet
  Type.newtype(:notify_refresh) do
    @doc = "Sends an arbitrary message to the agent run-time log."

    apply_to_all

    newproperty(:message, :idempotent => false) do
      desc "The message to be sent to the log."
      def sync(refreshing = false)
        if refreshing || !@resource.refreshonly?
          Puppet.send(@resource[:loglevel], self.should)
        end
        return
      end

      def retrieve
        :absent
      end

      def insync?(is)
        true
      end

      defaultto { @resource[:name] }
    end

    def refresh
      self.property(:message).sync(true)
    end

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

    newparam(:refreshonly, :boolean => true, :parent => Puppet::Parameter::Boolean) do
      defaultto false
    end

  end
end