Fix Billy Olsen's suggestions

This commit is contained in:
David Ames 2015-04-13 13:00:59 -07:00
parent 8c87320586
commit dc0bfbc00d
3 changed files with 7 additions and 6 deletions

View File

@ -37,4 +37,4 @@ unit_test: .venv
functional_test:
@echo Starting amulet tests...
@juju test -v -p AMULET_HTTP_PROXY --timeout 900
@juju test -v -p AMULET_HTTP_PROXY,OS_USERNAME,OS_TENANT_NAME,OS_REGION_NAME,OS_PASSWORD,OS_AUTH_URL --timeout 900

View File

@ -180,3 +180,4 @@ options:
in format [<vhost>, <queue>, <warn>, <crit>]
- ['/', 'queue1', 10, 20]
- ['/', 'queue2', 200, 300]
Wildcards '*' are accepted to monitor all vhosts and/or queues

View File

@ -51,7 +51,8 @@ from charmhelpers.core.hookenv import (
unit_get,
is_relation_made,
Hooks,
UnregisteredHookError
UnregisteredHookError,
charm_dir
)
from charmhelpers.core.host import (
cmp_pkgrevno,
@ -85,9 +86,8 @@ NAGIOS_PLUGINS = '/usr/local/lib/nagios/plugins'
SCRIPTS_DIR = '/usr/local/bin'
STATS_CRONFILE = '/etc/cron.d/rabbitmq-stats'
STATS_DATAFILE = os.path.join(RABBIT_DIR, 'data',
subprocess.check_output(
['hostname', '-s']).strip() +
'_queue_stats.dat')
'{}_queue_stats.dat'.format(
socket.gethostname()))
@hooks.hook('install')
@ -472,7 +472,7 @@ def update_nrpe_checks():
if config('stats_cron_schedule'):
script = os.path.join(SCRIPTS_DIR, 'collect_rabbitmq_stats.sh')
cronjob = "{} root {}\n".format(config('stats_cron_schedule'), script)
rsync(os.path.join(os.getenv('CHARM_DIR'), 'scripts',
rsync(os.path.join(charm_dir(), 'scripts',
'collect_rabbitmq_stats.sh'), script)
write_file(STATS_CRONFILE, cronjob)
elif os.path.isfile(STATS_CRONFILE):