Remove hiera usage from the rabbit-fence service

This change moves the hiera usage from the rabbit-fence service to
the cluster::rabbitmq_fence puppet class.

Related-Bug: #1603182
Change-Id: I109487d2cd1d0eab19dd995959e1fcc68594a1bc
Signed-off-by: Maksim Malchuk <mmalchuk@mirantis.com>
This commit is contained in:
Maksim Malchuk 2016-07-21 15:09:08 +03:00
parent 882b34bc6e
commit 8c341ac13e
2 changed files with 20 additions and 8 deletions

View File

@ -48,27 +48,38 @@ class cluster::rabbitmq_fence(
package { $packages: } ->
service { $dbus_service_name:
ensure => running,
enable => true,
ensure => running,
enable => true,
} ->
service { 'corosync-notifyd':
ensure => running,
enable => true,
ensure => running,
enable => true,
} ->
package { 'fuel-rabbit-fence': } ->
file { '/etc/rabbitmq/node_name_prefix_for_messaging':
ensure => file,
mode => '0644',
content => hiera('node_name_prefix_for_messaging', 'messaging-'),
notify => Service['rabbit-fence'],
require => Package['fuel-rabbit-fence'],
} ->
service { 'rabbit-fence':
ensure => $enabled ? {
true => running,
false => stopped },
name => $service_name,
enable => $enabled,
ensure => $enabled ? { true => running, false => stopped },
require => Package['rabbitmq-server'],
}
if $::osfamily == 'Debian' {
Exec {
path => [ '/bin', '/usr/bin' ],
before => Service['corosync-notifyd'],
path => [ '/bin', '/usr/bin' ],
before => Service['corosync-notifyd'],
}
exec { 'enable_corosync_notifyd':

View File

@ -49,7 +49,8 @@ def catchall_signal_lh(*args, **kwargs):
node = args[0]
this_node = socket.gethostname().split('.')[0]
node_name = node.split('.')[0]
node_name_prefix = bash_command('hiera node_name_prefix_for_messaging')
cmd = 'cat /etc/rabbitmq/node_name_prefix_for_messaging 2>/dev/null'
node_name_prefix = bash_command(cmd)
if node_name_prefix == 'nil' or node_name_prefix in node_name:
node_name_prefix = ''
node_to_remove = 'rabbit@%s%s' % (node_name_prefix, node_name)