3 Puppet::Type.type(:rabbitmq_erlang_cookie).provide(:ruby) do
4 confine feature: :posix
7 # Hack to prevent the create method from being called.
8 # We never need to create or destroy this resource, only change its value
13 raise('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.') unless resource[:force] == :true # Danger!
15 Puppet::Type.type(:service).new(name: resource[:service_name]).provider.stop
16 FileUtils.rm_rf(resource[:rabbitmq_home] + File::SEPARATOR + 'mnesia')
17 File.open(resource[:path], 'w') do |cookie|
21 FileUtils.chown(resource[:rabbitmq_user], resource[:rabbitmq_group], resource[:path])
25 if File.exist?(resource[:path])
26 File.read(resource[:path])