Skip to content

Commit

Permalink
Properly update rabbitmq
Browse files Browse the repository at this point in the history
This commit is setting modules to following state:
rabbitmq
 - old commit: 1cdf656
 - new commit: aa3ec5e

This commit is for properly update rabbitmq module, so we can
remove patch [1] from patches branches.

[1] 3f5a7e9

Change-Id: Ic22da93c413ab13a68d5a7d60d0a309141d752be
  • Loading branch information
paramite committed Sep 29, 2015
1 parent ede2198 commit 041b91e
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 118 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ mod 'qpid',
:git => 'https://github.com/dprince/puppet-qpid'

mod 'rabbitmq',
:commit => '1cdf6568473a0a45fb0b06b21b0c9a82c398bf08',
:commit => 'aa3ec5e061f619f4340a9c6ef1465f2f6a673cb4',
:git => 'https://github.com/puppetlabs/puppetlabs-rabbitmq.git'

mod 'redis',
Expand Down
9 changes: 9 additions & 0 deletions rabbitmq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ RabbitMQ Environment Variables in rabbitmq_env.config

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.
If you run Pacemaker and you don't want to use RabbitMQ buildin cluster, you can
set config_cluster to 'False' and set 'erlang_cookie'.

####`file_limit`

Expand Down Expand Up @@ -272,6 +274,13 @@ Boolean, whether or not to manage package repositories.

The port for the RabbitMQ management interface.

####`management_ssl`

Enable/Disable SSL for the maangement port.
Has an effect only if ssl => true.
Default is true.
Valid values are true or false.

####`node_ip_address`

The value of NODE_IP_ADDRESS in rabbitmq_env.config
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def exists?
def content=(value)
if resource[:force] == :true # Danger!
puppet('resource', 'service', resource[:service_name], 'ensure=stopped')
FileUtils.rm_rf(resource[:rabbitmq_home] + File::PATH_SEPARATOR + 'mnesia')
FileUtils.rm_rf(resource[:rabbitmq_home] + File::SEPARATOR + 'mnesia')
File.open(resource[:path], 'w') do |cookie|
cookie.chmod(0400)
cookie.write(value)
Expand Down
18 changes: 18 additions & 0 deletions rabbitmq/lib/puppet/type/rabbitmq_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ def validate_definition(definition)
raise ArgumentError, "Invalid expires value '#{expires_val}'"
end
end
if definition.key? 'message-ttl'
message_ttl_val = definition['message-ttl']
unless message_ttl_val.to_i.to_s == message_ttl_val
raise ArgumentError, "Invalid message-ttl value '#{message_ttl_val}'"
end
end
if definition.key? 'max-length'
max_length_val = definition['max-length']
unless max_length_val.to_i.to_s == max_length_val
raise ArgumentError, "Invalid max-length value '#{max_length_val}'"
end
end
end

def munge_definition(definition)
Expand All @@ -96,6 +108,12 @@ def munge_definition(definition)
if definition.key? 'expires'
definition['expires'] = definition['expires'].to_i
end
if definition.key? 'message-ttl'
definition['message-ttl'] = definition['message-ttl'].to_i
end
if definition.key? 'max-length'
definition['max-length'] = definition['max-length'].to_i
end
definition
end
end
43 changes: 20 additions & 23 deletions rabbitmq/manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$erlang_cookie = $rabbitmq::erlang_cookie
$interface = $rabbitmq::interface
$management_port = $rabbitmq::management_port
$management_ssl = $rabbitmq::management_ssl
$node_ip_address = $rabbitmq::node_ip_address
$plugin_dir = $rabbitmq::plugin_dir
$rabbitmq_user = $rabbitmq::rabbitmq_user
Expand Down Expand Up @@ -138,35 +139,31 @@
notify => Class['Rabbitmq::Service'],
refreshonly => true,
}
} else {
file { '/etc/security/limits.d/rabbitmq-server.conf':
content => template('rabbitmq/limits.conf'),
owner => '0',
group => '0',
mode => '0644',
notify => Class['Rabbitmq::Service'],
}
}
file { '/etc/security/limits.d/rabbitmq-server.conf':
content => template('rabbitmq/limits.conf'),
owner => '0',
group => '0',
mode => '0644',
notify => Class['Rabbitmq::Service'],
}
}
default: {
}
}

if $config_cluster {

if $erlang_cookie == undef {
fail('You must set the $erlang_cookie value in order to configure clustering.')
} else {
rabbitmq_erlang_cookie { "${rabbitmq_home}/.erlang.cookie":
content => $erlang_cookie,
force => $wipe_db_on_cookie_change,
rabbitmq_user => $rabbitmq_user,
rabbitmq_group => $rabbitmq_group,
rabbitmq_home => $rabbitmq_home,
service_name => $service_name,
before => File['rabbitmq.config'],
notify => Class['rabbitmq::service'],
}
if $erlang_cookie == undef and $config_cluster {
fail('You must set the $erlang_cookie value in order to configure clustering.')
} elsif $erlang_cookie != undef {
rabbitmq_erlang_cookie { "${rabbitmq_home}/.erlang.cookie":
content => $erlang_cookie,
force => $wipe_db_on_cookie_change,
rabbitmq_user => $rabbitmq_user,
rabbitmq_group => $rabbitmq_group,
rabbitmq_home => $rabbitmq_home,
service_name => $service_name,
before => File['rabbitmq.config'],
notify => Class['rabbitmq::service'],
}
}
}
5 changes: 2 additions & 3 deletions rabbitmq/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$erlang_cookie = $rabbitmq::params::erlang_cookie,
$interface = $rabbitmq::params::interface,
$management_port = $rabbitmq::params::management_port,
$management_ssl = $rabbitmq::params::management_ssl,
$node_ip_address = $rabbitmq::params::node_ip_address,
$package_apt_pin = $rabbitmq::params::package_apt_pin,
$package_ensure = $rabbitmq::params::package_ensure,
Expand Down Expand Up @@ -101,9 +102,7 @@
}
validate_bool($wipe_db_on_cookie_change)
validate_bool($tcp_keepalive)
if ! is_integer($file_limit) {
validate_re($file_limit, '^(unlimited|infinity)$', '$file_limit must be an integer, \'unlimited\', or \'infinity\'.')
}
validate_re($file_limit, '^(\d+|-1|unlimited|infinity)$', '$file_limit must be a positive integer, \'-1\', \'unlimited\', or \'infinity\'.')
# Validate service parameters.
validate_re($service_ensure, '^(running|stopped)$')
validate_bool($service_manage)
Expand Down
5 changes: 3 additions & 2 deletions rabbitmq/manifests/install/rabbitmqadmin.pp
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#
class rabbitmq::install::rabbitmqadmin {

if($rabbitmq::ssl) {
if($rabbitmq::ssl and $rabbitmq::management_ssl) {
$management_port = $rabbitmq::ssl_management_port
$protocol = 'https'
}
else {
$management_port = $rabbitmq::management_port
$protocol = 'http'
}

$default_user = $rabbitmq::default_user
$default_pass = $rabbitmq::default_pass
$protocol = $rabbitmq::ssl ? { false => 'http', default => 'https' }

staging::file { 'rabbitmqadmin':
target => "${rabbitmq::rabbitmq_home}/rabbitmqadmin",
Expand Down
3 changes: 2 additions & 1 deletion rabbitmq/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#install
$admin_enable = true
$management_port = '15672'
$management_ssl = true
$package_apt_pin = ''
$package_gpg_key = 'http://www.rabbitmq.com/rabbitmq-signing-key-public.asc'
$repos_ensure = true
Expand Down Expand Up @@ -117,5 +118,5 @@
$environment_variables = {}
$config_variables = {}
$config_kernel_variables = {}
$file_limit = 16384
$file_limit = '16384'
}
Loading

0 comments on commit 041b91e

Please sign in to comment.