Skip to content

Commit

Permalink
prevent sensu_client_subscription from rebuilding every run
Browse files Browse the repository at this point in the history
  • Loading branch information
jlambert121 committed Mar 7, 2013
1 parent 546fde5 commit caaf760
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/puppet/provider/sensu_client_subscription/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def initialize(*args)
super

begin
@conf = JSON.parse(File.read("/etc/sensu/conf.d/subscription_#{resource[:name]}.json"))
@conf = {'client' => { 'subscriptions' => JSON.parse(File.read("/etc/sensu/conf.d/subscription_#{resource[:name]}.json")) } }
rescue
@conf = {}
end
Expand All @@ -31,5 +31,16 @@ def destroy
def exists?
@conf.has_key? 'subscription'
end

def subscriptions
@conf['client']['subscriptions']
end

def subscriptions=(value)
@conf['client']['subscriptions'] = value
munge do |value|
Array(value)
end
end
end

5 changes: 5 additions & 0 deletions lib/puppet/type/sensu_client_subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ def initialize(*args)
desc "The subscription name"
end

newproperty(:subscriptions) do
desc "Subscriptions"
defaultto :name
end

autorequire(:package) do
['sensu']
end
Expand Down

0 comments on commit caaf760

Please sign in to comment.