diff options
Diffstat (limited to 'modules/base_installation/lib/puppet/type/notify_refresh.rb')
-rw-r--r-- | modules/base_installation/lib/puppet/type/notify_refresh.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/modules/base_installation/lib/puppet/type/notify_refresh.rb b/modules/base_installation/lib/puppet/type/notify_refresh.rb new file mode 100644 index 0000000..35f0cda --- /dev/null +++ b/modules/base_installation/lib/puppet/type/notify_refresh.rb | |||
@@ -0,0 +1,45 @@ | |||
1 | # | ||
2 | # Simple module for logging messages on the client-side | ||
3 | |||
4 | |||
5 | module Puppet | ||
6 | Type.newtype(:notify_refresh) do | ||
7 | @doc = "Sends an arbitrary message to the agent run-time log." | ||
8 | |||
9 | apply_to_all | ||
10 | |||
11 | newproperty(:message, :idempotent => false) do | ||
12 | desc "The message to be sent to the log." | ||
13 | def sync(refreshing = false) | ||
14 | if refreshing || !@resource.refreshonly? | ||
15 | Puppet.send(@resource[:loglevel], self.should) | ||
16 | end | ||
17 | return | ||
18 | end | ||
19 | |||
20 | def retrieve | ||
21 | :absent | ||
22 | end | ||
23 | |||
24 | def insync?(is) | ||
25 | true | ||
26 | end | ||
27 | |||
28 | defaultto { @resource[:name] } | ||
29 | end | ||
30 | |||
31 | def refresh | ||
32 | self.property(:message).sync(true) | ||
33 | end | ||
34 | |||
35 | newparam(:name) do | ||
36 | desc "An arbitrary tag for your own reference; the name of the message." | ||
37 | isnamevar | ||
38 | end | ||
39 | |||
40 | newparam(:refreshonly, :boolean => true, :parent => Puppet::Parameter::Boolean) do | ||
41 | defaultto false | ||
42 | end | ||
43 | |||
44 | end | ||
45 | end | ||