throw away prototype hooks, add hooks.py (stubs only atm)

This commit is contained in:
Paul Collins 2012-10-02 22:38:06 +13:00
parent 3e55c31017
commit d1940639ef
6 changed files with 43 additions and 27 deletions

39
hooks/hooks.py Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/python
#
# Copyright 2012 Canonical Ltd.
#
# Authors:
# Paul Collins <paul.collins@canonical.com>
#
import os
import subprocess
import sys
def install():
print "install"
def config_changed():
print "config_changed"
def mon_relation():
print "mon_relation"
hooks = {
'mon-relation-joined': mon_relation,
'mon-relation-changed': mon_relation,
'mon-relation-departed': mon_relation,
'install': install,
'config-changed': config_changed,
}
hook = os.path.basename(sys.argv[0])
try:
hooks[hook]()
except:
subprocess.call(['juju-log', '-l', 'INFO',
"This charm doesn't know how to handle '%s'." % hook])
sys.exit(0)

View File

@ -1,19 +0,0 @@
#!/bin/bash
set -e
set -u
# set up ceph package source
# XXX make this a charm config option
cat >/etc/apt/sources.list.d/ceph-brolin.list <<EOF
deb http://archive.admin.canonical.com/ubuntu precise-cat-ceph main
EOF
apt-get update
apt-get -y install ceph
# ceph-prepare-disk uses this, is only "suggests" in the package
apt-get -y install gdisk
exit 0

1
hooks/install Symbolic link
View File

@ -0,0 +1 @@
hooks.py

View File

@ -1,5 +0,0 @@
#!/bin/sh
set -e
set -u

View File

@ -1 +1 @@
mon-relation
hooks.py

View File

@ -1 +1 @@
mon-relation
hooks.py

View File

@ -1 +1 @@
mon-relation
hooks.py