1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/usr/bin/python import os import sys sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib')) from charmhelpers.core import ( hookenv, host, ) hooks = hookenv.Hooks() log = hookenv.log SERVICE = 'logstash' @hooks.hook('stop') def stop(): host.service_stop(SERVICE) if __name__ == "__main__": # execute a hook based on the name the program is called by hooks.execute(sys.argv) |