Project

General

Profile

Bug #5911 » mon-create-lsb.patch

use lsb module in __init__.py to simplify get init logic - Mark Kirkwood, 08/12/2013 06:35 PM

View differences:

ceph_deploy/hosts/__init__.py
module.release = release
module.codename = codename
module.sudo_conn = sudo_conn
module.init = lsb.choose_init(distro, codename)
return module
ceph_deploy/hosts/common.py
logger.debug('remote hostname: %s' % hostname)
path = paths.mon.path(args.cluster, hostname)
done_path = paths.mon.done(args.cluster, hostname)
if distro.name.lower() == 'ubuntu':
init = 'upstart'
else:
init = 'sysvinit'
init_path = paths.mon.init(args.cluster, hostname, init)
init_path = paths.mon.init(args.cluster, hostname, distro.init)
configuration = conf.load(args)
conf_data = StringIO()
ceph_deploy/hosts/debian/mon/create.py
hostname = distro.sudo_conn.modules.socket.gethostname().split('.')[0]
common.mon_create(distro, logger, args, monitor_keyring, hostname)
if distro.name.lower() == 'ubuntu':
if distro.init == 'upstart': # Ubuntu uses upstart
check_call(
distro.sudo_conn,
logger,
......
],
)
else: # Debian doesn't use initctl
elif distro.init == 'sysvinit': # Debian uses sysvinit
service = common.which_service(distro.sudo_conn, logger)
check_call(
......
'mon.{hostname}'.format(hostname=hostname)
],
)
else:
raise RuntimeError('create cannot use init %s' % init)
(4-4/4)