| #!/usr/bin/env python | |
| from charmhelpers.core import when, when_not | |
| import framework | |
| import helpers | |
| CONFIG_FILE = "/etc/myapp/app.conf" | |
| @when("db.connectable", "cache.ready") | |
| def regen_config(db, cache): | |
| data = {"dsn": db.dsn, "cache_url": dict(cache)} | |
| helpers.generate_template(CONFIG_FILE, "templates/app.config.j2", data) | |
| helpers.restart_service("myapp") | |
| @when_not("db.connectable", "cache.ready") | |
| def shutdown_service(): | |
| helpers.shutdown_service("myapp") | |
| if __name__ == '__main__': | |
| framework.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment