commit 0629a803d7a1ecb651ed34c402c41f72bafaec7d Author: Mark Kirkwood Date: Sun Nov 17 00:43:20 2013 +1300 Initial prototype for handling unknown distribution types. diff --git a/ceph_deploy/hosts/__init__.py b/ceph_deploy/hosts/__init__.py index f4ba203..8f6a541 100644 --- a/ceph_deploy/hosts/__init__.py +++ b/ceph_deploy/hosts/__init__.py @@ -6,7 +6,7 @@ on the type of distribution/version we are dealing with. """ import logging from ceph_deploy import exc, lsb -from ceph_deploy.hosts import debian, centos, fedora, suse, remotes +from ceph_deploy.hosts import debian, centos, fedora, suse, remotes, unknown from ceph_deploy.connection import get_connection logger = logging.getLogger() @@ -62,6 +62,7 @@ def _get_distro(distro, fallback=None): 'redhat': centos, 'fedora': fedora, 'suse': suse, + 'unknown': unknown, } try: return distributions[distro] @@ -79,4 +80,6 @@ def _normalized_distro_name(distro): return 'scientific' elif distro.startswith(('suse', 'opensuse')): return 'suse' + elif distro.startswith('unknown'): + return 'unknown' return distro diff --git a/ceph_deploy/hosts/remotes.py b/ceph_deploy/hosts/remotes.py index 62766f7..c759982 100644 --- a/ceph_deploy/hosts/remotes.py +++ b/ceph_deploy/hosts/remotes.py @@ -18,10 +18,21 @@ def platform_information(): major_version = release.split('.')[0] codename = debian_codenames.get(major_version, '') + distro = str(distro).rstrip(), + distro = str(release).rstrip(), + distro = str(codename).rstrip() + + if distro == '': + distro = 'unknown' + if release == '': + release = 'unknown' + if codename == '': + codename = 'unknown' + return ( - str(distro).rstrip(), - str(release).rstrip(), - str(codename).rstrip() + str(distro), + str(release), + str(codename) ) diff --git a/ceph_deploy/hosts/unknown/__init__.py b/ceph_deploy/hosts/unknown/__init__.py new file mode 100644 index 0000000..d67ad7e --- /dev/null +++ b/ceph_deploy/hosts/unknown/__init__.py @@ -0,0 +1,8 @@ +import mon + +# Allow to set some information about this distro +# + +distro = None +release = None +codename = None diff --git a/ceph_deploy/hosts/unknown/mon/__init__.py b/ceph_deploy/hosts/unknown/mon/__init__.py new file mode 100644 index 0000000..fca0e0d --- /dev/null +++ b/ceph_deploy/hosts/unknown/mon/__init__.py @@ -0,0 +1 @@ +from create import create diff --git a/ceph_deploy/hosts/unknown/mon/create.py b/ceph_deploy/hosts/unknown/mon/create.py new file mode 100644 index 0000000..ed2a3ba --- /dev/null +++ b/ceph_deploy/hosts/unknown/mon/create.py @@ -0,0 +1,30 @@ +from ceph_deploy.hosts import common +from ceph_deploy.lib.remoto import process + + +def create(distro, args, monitor_keyring): + hostname = distro.conn.remote_module.shortname() + common.mon_create(distro, args, monitor_keyring, hostname) + + # no idea about startup architecture so start directly, run + create keys + process.run( + distro.conn, + [ + 'ceph-mon', + '--cluster', args.cluster, + '-c', '/etc/ceph/{cluster}.conf'.format(cluster=args.cluster), + '-i', hostname, + ], + timeout=7, + ) + + process.run( + distro.conn, + [ + 'ceph-create-keys', + '--cluster', args.cluster, + '-i', hostname, + ], + timeout=7, + ) +