Skip to content

Commit

Permalink
Stop setting a default cookie
Browse files Browse the repository at this point in the history
Like passwords, secret cookies shouldn't have defaults. This
change removes the default and hard fails when a value is needed and
not set.
  • Loading branch information
Colleen Murphy committed Dec 20, 2014
1 parent 5c485b8 commit 780b638
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 61 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ RabbitMQ Environment Variables in rabbitmq_env.config
####`erlang_cookie`

The erlang cookie to use for clustering - must be the same between all nodes.
This value has no default and must be set explicitly if using clustering.

###`key_content`

Expand Down
14 changes: 0 additions & 14 deletions lib/puppet/type/rabbitmq_erlang_cookie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,6 @@

newparam(:path, :namevar => true)

validate do
# This does pre-validation on the content property and force parameter.
# The intent is to simulate the prior behavior to the invention of this
# type (see https://github.com/puppetlabs/puppetlabs-rabbitmq/blob/4.1.0/manifests/config.pp#L87-L117)
# where validation occurs before the catalog starts being applied.
# This prevents other resources from failing after attempting to apply
# this resource and having it fail due to the force parameter being
# set to false.
is = (File.read(self[:path]) if File.exists?(self[:path])) || ''
should = self[:content]
failstring = '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 tohappen automatically.'
fail(failstring) if (is != should && self[:force] != :true)
end

newproperty(:content) do
desc 'Content of cookie'
newvalues(/^\S+$/)
Expand Down
1 change: 0 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
require => File['/etc/rabbitmq'],
}


if $config_cluster {

if $erlang_cookie == undef {
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
$delete_guest_user = false
$env_config = 'rabbitmq/rabbitmq-env.conf.erb'
$env_config_path = '/etc/rabbitmq/rabbitmq-env.conf'
$erlang_cookie = 'EOKOWXQREETZSHFNTPEY'
$erlang_cookie = undef
$node_ip_address = 'UNSET'
$plugin_dir = "/usr/lib/rabbitmq/lib/rabbitmq_server-${version}/plugins"
$port = '5672'
Expand Down
45 changes: 0 additions & 45 deletions spec/unit/puppet/type/rabbitmq_erlang_cookie_spec.rb

This file was deleted.

0 comments on commit 780b638

Please sign in to comment.