3 Puppet::Type.type(:rabbitmq_erlang_cookie).provide(:ruby) do
5 defaultfor :feature => :posix
6 has_command(:puppet, 'puppet') do
7 environment :PATH => '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin'
11 # Hack to prevent the create method from being called.
12 # We never need to create or destroy this resource, only change its value
17 if resource[:force] == :true # Danger!
18 puppet('resource', 'service', resource[:service_name], 'ensure=stopped')
19 FileUtils.rm_rf(resource[:rabbitmq_home] + File::PATH_SEPARATOR + 'mnesia')
20 File.open(resource[:path], 'w') do |cookie|
24 FileUtils.chown(resource[:rabbitmq_user], resource[:rabbitmq_group], resource[:path])
26 fail("The current erlang cookie needs to change. In order to do this the RabbitMQ database needs to be wiped. Please set force => true to allow this to happen automatically.")
31 if File.exists?(resource[:path])
32 File.read(resource[:path])