setting correct perms on pass files for unison
This commit is contained in:
@@ -16,6 +16,7 @@ COOKIE_PATH = '/var/lib/rabbitmq/.erlang.cookie'
|
|||||||
ENV_CONF = '/etc/rabbitmq/rabbitmq-env.conf'
|
ENV_CONF = '/etc/rabbitmq/rabbitmq-env.conf'
|
||||||
RABBITMQ_CONF = '/etc/rabbitmq/rabbitmq.config'
|
RABBITMQ_CONF = '/etc/rabbitmq/rabbitmq.config'
|
||||||
SSH_USER = 'juju_rabbit'
|
SSH_USER = 'juju_rabbit'
|
||||||
|
RABBIT_USER = 'rabbitmq'
|
||||||
LIB_PATH = '/var/lib/rabbitmq/'
|
LIB_PATH = '/var/lib/rabbitmq/'
|
||||||
|
|
||||||
|
|
||||||
@@ -229,6 +230,7 @@ def synchronize_service_credentials():
|
|||||||
peers = cluster.peer_units()
|
peers = cluster.peer_units()
|
||||||
if peers and not cluster.oldest_peer(peers):
|
if peers and not cluster.oldest_peer(peers):
|
||||||
utils.juju_log('INFO', 'Deferring action to oldest service unit.')
|
utils.juju_log('INFO', 'Deferring action to oldest service unit.')
|
||||||
|
return
|
||||||
|
|
||||||
utils.juju_log('INFO', 'Synchronizing service passwords to all peers.')
|
utils.juju_log('INFO', 'Synchronizing service passwords to all peers.')
|
||||||
unison.sync_to_peers(peer_interface='cluster',
|
unison.sync_to_peers(peer_interface='cluster',
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ def install():
|
|||||||
|
|
||||||
# ensure user + permissions for peer relations that
|
# ensure user + permissions for peer relations that
|
||||||
# may be syncing data there via SSH_USER.
|
# may be syncing data there via SSH_USER.
|
||||||
unison.ensure_user(user=rabbit.SSH_USER, group='rabbit')
|
unison.ensure_user(user=rabbit.SSH_USER, group=rabbit.RABBIT_USER)
|
||||||
rabbit.execute("chmod -R u+wrx %s" % rabbit.LIB_PATH)
|
rabbit.execute("chmod g+wrx %s" % rabbit.LIB_PATH)
|
||||||
|
|
||||||
|
|
||||||
def amqp_changed(relation_id=None, remote_unit=None, needs_leader=True):
|
def amqp_changed(relation_id=None, remote_unit=None, needs_leader=True):
|
||||||
@@ -59,6 +59,9 @@ def amqp_changed(relation_id=None, remote_unit=None, needs_leader=True):
|
|||||||
password = subprocess.check_output(cmd).strip()
|
password = subprocess.check_output(cmd).strip()
|
||||||
with open(password_file, 'wb') as out:
|
with open(password_file, 'wb') as out:
|
||||||
out.write(password)
|
out.write(password)
|
||||||
|
# assign current user and permissions
|
||||||
|
rabbit.execute("chmod g+wrx %s" % password_file)
|
||||||
|
rabbit.execute("chown %s:%s %s" % rabbit.RABBIT_USER, rabbit.RABBIT_USER, password_file)
|
||||||
|
|
||||||
rabbit.create_vhost(vhost)
|
rabbit.create_vhost(vhost)
|
||||||
rabbit.create_user(rabbit_user, password)
|
rabbit.create_user(rabbit_user, password)
|
||||||
@@ -290,7 +293,7 @@ def update_nrpe_checks():
|
|||||||
|
|
||||||
nrpe_compat = NRPE()
|
nrpe_compat = NRPE()
|
||||||
nrpe_compat.add_check(
|
nrpe_compat.add_check(
|
||||||
shortname='rabbitmq',
|
shortname=rabbit.RABBIT_USER,
|
||||||
description='Check RabbitMQ',
|
description='Check RabbitMQ',
|
||||||
check_cmd='{}/check_rabbitmq.py --user {} --password {} --vhost {}'
|
check_cmd='{}/check_rabbitmq.py --user {} --password {} --vhost {}'
|
||||||
''.format(NAGIOS_PLUGINS, user, password, vhost)
|
''.format(NAGIOS_PLUGINS, user, password, vhost)
|
||||||
@@ -317,7 +320,7 @@ MAN_PLUGIN = 'rabbitmq_management'
|
|||||||
|
|
||||||
def config_changed():
|
def config_changed():
|
||||||
unison.ensure_user(user=rabbit.SSH_USER, group='rabbit')
|
unison.ensure_user(user=rabbit.SSH_USER, group='rabbit')
|
||||||
rabbit.execute("chmod -R u+wrx %s" % rabbit.LIB_PATH)
|
rabbit.execute("chmod g+wrx %s" % rabbit.LIB_PATH)
|
||||||
|
|
||||||
if utils.config_get('management_plugin') is True:
|
if utils.config_get('management_plugin') is True:
|
||||||
rabbit.enable_plugin(MAN_PLUGIN)
|
rabbit.enable_plugin(MAN_PLUGIN)
|
||||||
|
|||||||
Reference in New Issue
Block a user