1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | @hook('update-status') def update_status(): avail = { 'nginx': is_state('nginx.available'), 'django': is_state('django.ready'), 'psql': is_state('postgres.database.available'), } cur_status = status_get() if not avail['psql']: return status_set('blocked', 'postgres database required') ready = avail['nginx'] and avail['django'] and avail['psql'] if ready: status_set('active', 'ready') status_set('waiting', ', '.join(['%s: %s' % (k, msg[v]) for k, v in avail.items()])) |