diff --git a/lib/puppet/provider/sensu_client_subscription/json.rb b/lib/puppet/provider/sensu_client_subscription/json.rb index 907303cdc3..853a2af111 100644 --- a/lib/puppet/provider/sensu_client_subscription/json.rb +++ b/lib/puppet/provider/sensu_client_subscription/json.rb @@ -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 @@ -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 diff --git a/lib/puppet/type/sensu_client_subscription.rb b/lib/puppet/type/sensu_client_subscription.rb index 7e9743d6bc..759b0f3344 100644 --- a/lib/puppet/type/sensu_client_subscription.rb +++ b/lib/puppet/type/sensu_client_subscription.rb @@ -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