~ionutbalutoiu/charms/trusty/neutron-api/next

« back to all changes in this revision

Viewing changes to hooks/neutron_api_hooks.py

  • Committer: James Page
  • Date: 2015-01-13 14:43:04 UTC
  • mfrom: (71 trunk)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: james.page@ubuntu.com-20150113144304-yqhknhbuhyfzsd7g
Rebase on next

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    do_openstack_upgrade,
46
46
    register_configs,
47
47
    restart_map,
 
48
    services,
48
49
    setup_ipv6
49
50
)
50
51
from neutron_api_context import (
73
74
 
74
75
from charmhelpers.contrib.openstack.context import ADDRESS_TYPES
75
76
 
 
77
from charmhelpers.contrib.charmsupport import nrpe
 
78
 
76
79
hooks = Hooks()
77
80
CONFIGS = register_configs()
78
81
 
120
123
    if openstack_upgrade_available('neutron-server'):
121
124
        do_openstack_upgrade(CONFIGS)
122
125
    configure_https()
 
126
    update_nrpe_config()
123
127
    CONFIGS.write_all()
124
128
    for r_id in relation_ids('neutron-api'):
125
129
        neutron_api_relation_joined(rid=r_id)
373
377
        neutron_api_relation_joined(rid=rid)
374
378
 
375
379
 
 
380
@hooks.hook('nrpe-external-master-relation-joined',
 
381
            'nrpe-external-master-relation-changed')
 
382
def update_nrpe_config():
 
383
    # python-dbus is used by check_upstart_job
 
384
    apt_install('python-dbus')
 
385
    hostname = nrpe.get_nagios_hostname()
 
386
    current_unit = nrpe.get_nagios_unit_name()
 
387
    nrpe_setup = nrpe.NRPE(hostname=hostname)
 
388
    nrpe.add_init_service_checks(nrpe_setup, services(), current_unit)
 
389
    nrpe_setup.write()
 
390
 
 
391
 
376
392
def main():
377
393
    try:
378
394
        hooks.execute(sys.argv)