diff --git a/ceph_deploy/calamari.py b/ceph_deploy/calamari.py deleted file mode 100644 index 9bbea65c..00000000 --- a/ceph_deploy/calamari.py +++ /dev/null @@ -1,108 +0,0 @@ -import errno -import logging -import os -from ceph_deploy import hosts, exc -from ceph_deploy.lib import remoto - - -LOG = logging.getLogger(__name__) - - -def distro_is_supported(distro_name): - """ - An enforcer of supported distros that can differ from what ceph-deploy - supports. - """ - supported = ['centos', 'redhat', 'ubuntu', 'debian'] - if distro_name in supported: - return True - return False - - -def connect(args): - for hostname in args.hosts: - distro = hosts.get(hostname, username=args.username) - if not distro_is_supported(distro.normalized_name): - raise exc.UnsupportedPlatform( - distro.distro_name, - distro.codename, - distro.release - ) - - LOG.info( - 'Distro info: %s %s %s', - distro.name, - distro.release, - distro.codename - ) - LOG.info('assuming that a repository with Calamari packages is already configured.') - LOG.info('Refer to the docs for examples (http://ceph.com/ceph-deploy/docs/conf.html)') - - rlogger = logging.getLogger(hostname) - - # Emplace minion config prior to installation so that it is present - # when the minion first starts. - minion_config_dir = os.path.join('/etc/salt/', 'minion.d') - minion_config_file = os.path.join(minion_config_dir, 'calamari.conf') - - rlogger.debug('creating config dir: %s' % minion_config_dir) - distro.conn.remote_module.makedir(minion_config_dir, [errno.EEXIST]) - - rlogger.debug( - 'creating the calamari salt config: %s' % minion_config_file - ) - distro.conn.remote_module.write_file( - minion_config_file, - ('master: %s\n' % args.master).encode('utf-8') - ) - - distro.packager.install('salt-minion') - distro.packager.install('diamond') - - # redhat/centos need to get the service started - if distro.normalized_name in ['redhat', 'centos']: - remoto.process.run( - distro.conn, - ['chkconfig', 'salt-minion', 'on'] - ) - - remoto.process.run( - distro.conn, - ['service', 'salt-minion', 'start'] - ) - - distro.conn.exit() - - -def calamari(args): - if args.subcommand == 'connect': - connect(args) - - -def make(parser): - """ - Install and configure Calamari nodes. Assumes that a repository with - Calamari packages is already configured. Refer to the docs for examples - (http://ceph.com/ceph-deploy/docs/conf.html) - """ - calamari_parser = parser.add_subparsers(dest='subcommand') - calamari_parser.required = True - - calamari_connect = calamari_parser.add_parser( - 'connect', - help='Configure host(s) to connect to Calamari master' - ) - calamari_connect.add_argument( - '--master', - nargs='?', - metavar='MASTER SERVER', - help="The domain for the Calamari master server" - ) - calamari_connect.add_argument( - 'hosts', - nargs='+', - ) - - parser.set_defaults( - func=calamari, - ) diff --git a/ceph_deploy/tests/parser/test_calamari.py b/ceph_deploy/tests/parser/test_calamari.py deleted file mode 100644 index ee97adb0..00000000 --- a/ceph_deploy/tests/parser/test_calamari.py +++ /dev/null @@ -1,49 +0,0 @@ -import pytest - -from ceph_deploy.cli import get_parser -from ceph_deploy.tests.util import assert_too_few_arguments - - -class TestParserCalamari(object): - - def setup(self): - self.parser = get_parser() - - def test_calamari_help(self, capsys): - with pytest.raises(SystemExit): - self.parser.parse_args('calamari --help'.split()) - out, err = capsys.readouterr() - assert 'usage: ceph-deploy calamari' in out - assert 'positional arguments:' in out - assert 'optional arguments:' in out - - def test_calamari_connect_help(self, capsys): - with pytest.raises(SystemExit): - self.parser.parse_args('calamari connect --help'.split()) - out, err = capsys.readouterr() - assert 'usage: ceph-deploy calamari connect' in out - assert 'positional arguments:' in out - assert 'optional arguments:' in out - - def test_calamari_connect_host_required(self, capsys): - with pytest.raises(SystemExit): - self.parser.parse_args('calamari connect'.split()) - out, err = capsys.readouterr() - assert_too_few_arguments(err) - - def test_calamari_connect_one_host(self): - args = self.parser.parse_args('calamari connect host1'.split()) - assert args.hosts == ['host1'] - - def test_calamari_connect_multiple_hosts(self): - hostnames = ['host1', 'host2', 'host3'] - args = self.parser.parse_args('calamari connect'.split() + hostnames) - assert args.hosts == hostnames - - def test_calamari_connect_master_default_is_none(self): - args = self.parser.parse_args('calamari connect host1'.split()) - assert args.master is None - - def test_calamari_connect_master_custom(self): - args = self.parser.parse_args('calamari connect --master master.ceph.com host1'.split()) - assert args.master == "master.ceph.com" diff --git a/ceph_deploy/tests/parser/test_main.py b/ceph_deploy/tests/parser/test_main.py index 5a71ec16..ac7186e9 100644 --- a/ceph_deploy/tests/parser/test_main.py +++ b/ceph_deploy/tests/parser/test_main.py @@ -7,7 +7,7 @@ SUBCMDS_WITH_ARGS = [ 'new', 'install', 'rgw', 'mds', 'mon', 'gatherkeys', 'disk', 'osd', - 'admin', 'config', 'uninstall', 'purgedata', 'purge', 'pkg', 'calamari' + 'admin', 'config', 'uninstall', 'purgedata', 'purge', 'pkg' ] SUBCMDS_WITHOUT_ARGS = ['forgetkeys'] diff --git a/ceph_deploy/tests/unit/test_calamari.py b/ceph_deploy/tests/unit/test_calamari.py deleted file mode 100644 index ce85bfd9..00000000 --- a/ceph_deploy/tests/unit/test_calamari.py +++ /dev/null @@ -1,17 +0,0 @@ -import pytest -from ceph_deploy import calamari - - -class TestDistroIsSupported(object): - - @pytest.mark.parametrize( - "distro_name", - ['centos', 'redhat', 'ubuntu', 'debian']) - def test_distro_is_supported(self, distro_name): - assert calamari.distro_is_supported(distro_name) is True - - @pytest.mark.parametrize( - "distro_name", - ['fedora', 'mandriva', 'darwin', 'windows']) - def test_distro_is_not_supported(self, distro_name): - assert calamari.distro_is_supported(distro_name) is False diff --git a/setup.py b/setup.py index 74b85ff9..c4fd46f2 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,6 @@ def read(fname): 'config = ceph_deploy.config:make', 'admin = ceph_deploy.admin:make', 'pkg = ceph_deploy.pkg:make', - 'calamari = ceph_deploy.calamari:make', 'rgw = ceph_deploy.rgw:make', 'repo = ceph_deploy.repo:make', ],