Index: ceph-deploy-1.5.10/ceph_deploy/calamari.py =================================================================== --- ceph-deploy-1.5.10.orig/ceph_deploy/calamari.py +++ ceph-deploy-1.5.10/ceph_deploy/calamari.py @@ -4,6 +4,30 @@ import os from ceph_deploy import hosts, exc from ceph_deploy.lib import remoto +# +# For use on SLES, `ceph-deploy calamari` doesn't use a calamari minion repo. +# Rather, it relies on your Ceph nodes already having access to a respository +# that containts salt-minion and its dependencies, as well as diamond, which +# salt-minion will in turn install. This completely removes any need to +# specify repos, or alter your ~/.cephdeploy.conf file at all (which is what +# (http://calamari.readthedocs.org/en/latest/operations/minion_connect.html +# says you need to do). +# +# All you need to do to hook some set of Ceph nodes up to a calamari instance +# is run: +# +# ceph-deploy calamari connect --master [ ...] +# +# For example: +# +# ceph-deploy calamari connect --master calamari.example.com \ +# ceph-0.example.com ceph-1.example.com ceph-2.example.com +# +# Or, if you are running ceph-deploy from your calamari host: +# +# ceph-deploy calamari connect --master $(hostname -f) \ +# ceph-0.example.com ceph-1.example.com ceph-2.example.com +# LOG = logging.getLogger(__name__) @@ -13,30 +37,18 @@ def distro_is_supported(distro_name): An enforcer of supported distros that can differ from what ceph-deploy supports. """ - supported = ['centos', 'redhat', 'ubuntu', 'debian'] + supported = ['suse'] if distro_name in supported: return True return False def connect(args): - cd_conf = getattr(args, 'cd_conf', None) - if not cd_conf: - raise RuntimeError( - 'a ceph-deploy configuration is required but was not found' - ) - - repo_name = args.release or 'calamari-minion' - has_minion_repo = cd_conf.has_section(repo_name) - - if not has_minion_repo: - raise RuntimeError('no calamari-minion repo found') - 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.name, distro.codename, distro.release ) @@ -48,36 +60,8 @@ def connect(args): distro.codename ) - # We rely on the default for repo installs that does not install ceph - # unless specified otherwise. We define the `options` dictionary here - # because ceph-deploy pops items iternally and that causes issues when - # those items need to be available for every host - options = dict(cd_conf.items(repo_name)) - rlogger = logging.getLogger(hostname) - if distro.name in ('debian', 'ubuntu'): - rlogger.info('ensuring proxy is disabled for calamari minions repo') - distro.conn.remote_module.write_file( - '/etc/apt/apt.conf.d/99ceph', - 'Acquire::http::Proxy::%s DIRECT;' % args.master, - ) rlogger.info('installing calamari-minion package on %s' % hostname) - rlogger.info('adding custom repository file') - try: - distro.repo_install( - distro, - repo_name, - options.pop('baseurl'), - options.pop('gpgkey', ''), # will probably not use a gpgkey - **options - ) - except KeyError as err: - raise RuntimeError( - 'missing required key: %s in config section: %s' % ( - err, - repo_name - ) - ) # Emplace minion config prior to installation so that it is present # when the minion first starts. @@ -97,17 +81,15 @@ def connect(args): distro.pkg.install(distro, 'salt-minion') - # 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, + ['systemctl', 'enable', 'salt-minion'] + ) - remoto.process.run( - distro.conn, - ['service', 'salt-minion', 'start'] - ) + remoto.process.run( + distro.conn, + ['systemctl', 'start', 'salt-minion'] + ) distro.conn.exit() @@ -129,20 +111,9 @@ def make(parser): ) parser.add_argument( - '--release', - nargs='?', - metavar='CODENAME', - help="Use a given release from repositories\ - defined in ceph-deploy's configuration. Defaults to\ - 'calamari-minion'", - - ) - - parser.add_argument( '--master', - nargs='?', - metavar='MASTER SERVER', - help="The domain for the Calamari master server" + required=True, + help="The fully qualified domain name of the Calamari server" ) parser.add_argument( Index: ceph-deploy-1.5.10/ceph_deploy/tests/unit/test_calamari.py =================================================================== --- ceph-deploy-1.5.10.orig/ceph_deploy/tests/unit/test_calamari.py +++ ceph-deploy-1.5.10/ceph_deploy/tests/unit/test_calamari.py @@ -6,12 +6,12 @@ class TestDistroIsSupported(object): @pytest.mark.parametrize( "distro_name", - ['centos', 'redhat', 'ubuntu', 'debian']) + ['suse']) 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']) + ['centos', 'redhat', 'ubuntu', 'debian', 'fedora', 'mandriva', 'darwin', 'windows']) def test_distro_is_not_supported(self, distro_name): assert calamari.distro_is_supported(distro_name) is False