Update units, mark mon managed by upstart

This commit is contained in:
James Page
2013-01-11 08:59:51 +00:00
parent 75077816be
commit 3993cb13ec
2 changed files with 19 additions and 1 deletions

View File

@@ -115,6 +115,7 @@ def get_mon_hosts():
def bootstrap_monitor_cluster():
hostname = utils.get_unit_hostname()
done = '/var/lib/ceph/mon/ceph-{}/done'.format(hostname)
upstart = '/var/lib/ceph/mon/ceph-{}/upstart'.format(hostname)
secret = utils.config_get('monitor-secret')
keyring = '/var/lib/ceph/tmp/{}.mon.keyring'.format(hostname)
@@ -134,6 +135,8 @@ def bootstrap_monitor_cluster():
with open(done, 'w'):
pass
with open(upstart, 'w'):
pass
subprocess.check_call(['start', 'ceph-mon-all-starter'])
except:

View File

@@ -11,16 +11,19 @@ import os
import subprocess
import socket
import sys
import re
def do_hooks(hooks):
hook = os.path.basename(sys.argv[0])
try:
hooks[hook]()
hook_func = hooks[hook]
except KeyError:
juju_log('INFO',
"This charm doesn't know how to handle '{}'.".format(hook))
else:
hook_func()
def install(*pkgs):
@@ -88,6 +91,18 @@ def configure_source():
]
subprocess.check_call(cmd)
def enable_pocket(pocket):
apt_sources = "/etc/apt/sources.list"
with open(apt_sources, "r") as sources:
lines = sources.readlines()
with open(apt_sources, "w") as sources:
for line in lines:
if pocket in line:
sources.write(re.sub('^# deb', 'deb', line))
else:
sources.write(line)
# Protocols
TCP = 'TCP'
UDP = 'UDP'