5ff961
From 9d5f9d21442ee483044fc55a5c02039af23869d7 Mon Sep 17 00:00:00 2001
f2a40f
From: Rob Crittenden <rcritten@redhat.com>
5ff961
Date: Thu, 1 Dec 2022 14:22:46 -0500
f2a40f
Subject: [PATCH] Remove ipaclustercheck
f2a40f
f2a40f
---
f2a40f
 setup.py                              |  12 +-
f2a40f
 src/ipaclustercheck/__init__.py       |   5 -
f2a40f
 src/ipaclustercheck/core/__init__.py  |   0
f2a40f
 src/ipaclustercheck/core/main.py      |  32 ------
f2a40f
 src/ipaclustercheck/core/output.py    |  68 -----------
f2a40f
 src/ipaclustercheck/ipa/__init__.py   |   0
f2a40f
 src/ipaclustercheck/ipa/crlmanager.py |  36 ------
f2a40f
 src/ipaclustercheck/ipa/plugin.py     | 117 -------------------
f2a40f
 src/ipaclustercheck/ipa/ruv.py        | 155 --------------------------
f2a40f
 tests/test_cluster_ruv.py             | 106 ------------------
f2a40f
 10 files changed, 1 insertion(+), 530 deletions(-)
f2a40f
 delete mode 100644 src/ipaclustercheck/__init__.py
f2a40f
 delete mode 100644 src/ipaclustercheck/core/__init__.py
f2a40f
 delete mode 100644 src/ipaclustercheck/core/main.py
f2a40f
 delete mode 100644 src/ipaclustercheck/core/output.py
f2a40f
 delete mode 100644 src/ipaclustercheck/ipa/__init__.py
f2a40f
 delete mode 100644 src/ipaclustercheck/ipa/crlmanager.py
f2a40f
 delete mode 100644 src/ipaclustercheck/ipa/plugin.py
f2a40f
 delete mode 100644 src/ipaclustercheck/ipa/ruv.py
f2a40f
 delete mode 100644 tests/test_cluster_ruv.py
f2a40f
f2a40f
diff --git a/setup.py b/setup.py
5ff961
index 0cfa486..b9e1ca1 100644
f2a40f
--- a/setup.py
f2a40f
+++ b/setup.py
f2a40f
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
f2a40f
 setup(
f2a40f
     name='ipahealthcheck',
5ff961
     version='0.12',
f2a40f
-    namespace_packages=['ipahealthcheck', 'ipaclustercheck'],
f2a40f
+    namespace_packages=['ipahealthcheck'],
f2a40f
     package_dir={'': 'src'},
f2a40f
     # packages=find_packages(where='src'),
f2a40f
     packages=[
f2a40f
@@ -14,14 +14,11 @@ setup(
f2a40f
         'ipahealthcheck.ipa',
f2a40f
         'ipahealthcheck.meta',
f2a40f
         'ipahealthcheck.system',
f2a40f
-        'ipaclustercheck.core',
f2a40f
-        'ipaclustercheck.ipa',
f2a40f
     ],
f2a40f
     entry_points={
f2a40f
         # creates bin/ipahealthcheck
f2a40f
         'console_scripts': [
f2a40f
             'ipa-healthcheck = ipahealthcheck.core.main:main',
f2a40f
-            'ipa-clustercheck = ipaclustercheck.core.main:main',
f2a40f
         ],
f2a40f
         # subsystem registries
f2a40f
         'ipahealthcheck.registry': [
5ff961
@@ -72,13 +69,6 @@ setup(
f2a40f
         'ipahealthcheck.system': [
f2a40f
             'filesystemspace = ipahealthcheck.system.filesystemspace',
f2a40f
         ],
f2a40f
-        'ipaclustercheck.registry': [
f2a40f
-            'ipaclustercheck.ipa = ipaclustercheck.ipa.plugin:registry',
f2a40f
-        ],
f2a40f
-        'ipaclustercheck.ipa': [
f2a40f
-            'crl = ipaclustercheck.ipa.crlmanager',
f2a40f
-            'ruv = ipaclustercheck.ipa.ruv',
f2a40f
-        ],
f2a40f
     },
f2a40f
     classifiers=[
f2a40f
         'Programming Language :: Python :: 3.6',
f2a40f
diff --git a/src/ipaclustercheck/__init__.py b/src/ipaclustercheck/__init__.py
f2a40f
deleted file mode 100644
f2a40f
index 6c91ef7..0000000
f2a40f
--- a/src/ipaclustercheck/__init__.py
f2a40f
+++ /dev/null
f2a40f
@@ -1,5 +0,0 @@
f2a40f
-#
f2a40f
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
f2a40f
-#
f2a40f
-
f2a40f
-__import__('pkg_resources').declare_namespace(__name__)
f2a40f
diff --git a/src/ipaclustercheck/core/__init__.py b/src/ipaclustercheck/core/__init__.py
f2a40f
deleted file mode 100644
f2a40f
index e69de29..0000000
f2a40f
diff --git a/src/ipaclustercheck/core/main.py b/src/ipaclustercheck/core/main.py
f2a40f
deleted file mode 100644
f2a40f
index f475832..0000000
f2a40f
--- a/src/ipaclustercheck/core/main.py
f2a40f
+++ /dev/null
f2a40f
@@ -1,32 +0,0 @@
f2a40f
-#
f2a40f
-# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
f2a40f
-#
f2a40f
-
f2a40f
-import sys
f2a40f
-
f2a40f
-from ipaclustercheck.core.output import output_registry
f2a40f
-from ipahealthcheck.core.core import RunChecks
f2a40f
-
f2a40f
-
f2a40f
-class ClusterChecks(RunChecks):
f2a40f
-
f2a40f
-    def add_options(self):
f2a40f
-        parser = self.parser
f2a40f
-        parser.add_argument('--directory', dest='dir',
f2a40f
-                            help='Directory holding healthcheck logs')
f2a40f
-
f2a40f
-    def validate_options(self):
f2a40f
-        super().validate_options()
f2a40f
-
f2a40f
-        if self.options.dir is None:
f2a40f
-            print("--directory containing logs to check is required")
f2a40f
-            return 1
f2a40f
-
f2a40f
-        return None
f2a40f
-
f2a40f
-
f2a40f
-def main():
f2a40f
-    clusterchecks = ClusterChecks(['ipaclustercheck.registry'],
f2a40f
-                                   '/etc/ipa/clustercheck.conf',
f2a40f
-                                   output_registry, 'ansible')
f2a40f
-    sys.exit(clusterchecks.run_healthcheck())
f2a40f
diff --git a/src/ipaclustercheck/core/output.py b/src/ipaclustercheck/core/output.py
f2a40f
deleted file mode 100644
5ff961
index 909eac4..0000000
f2a40f
--- a/src/ipaclustercheck/core/output.py
f2a40f
+++ /dev/null
f2a40f
@@ -1,68 +0,0 @@
f2a40f
-#
f2a40f
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
f2a40f
-#
f2a40f
-
f2a40f
-import json
f2a40f
-from ipahealthcheck.core.output import OutputRegistry, Output
f2a40f
-
f2a40f
-
f2a40f
-output_registry = OutputRegistry()
f2a40f
-
f2a40f
-class ClusterOutput(Output):
f2a40f
-    """Base class for writing/display output of cluster results
f2a40f
-
f2a40f
-       severity doesn't apply in this case so exclude those.
f2a40f
-    """
f2a40f
-    def __init__(self, options):
5ff961
-        self.filename = options.output_file
f2a40f
-
f2a40f
-    def strip_output(self, results):
f2a40f
-        """Nothing to strip out"""
f2a40f
-        return list(results.output())
f2a40f
-
f2a40f
-    def generate(self, data):
f2a40f
-        raise NotImplementedError
f2a40f
-
f2a40f
-
f2a40f
-@output_registry
f2a40f
-class Ansible(ClusterOutput):
f2a40f
-    """Output information JSON format for consumption by Ansible
f2a40f
-
f2a40f
-       Required keywords in a Result:
f2a40f
-       name - unique identifier for the return value
f2a40f
-
f2a40f
-       One of these is required:
f2a40f
-       value - the return value. Type? I dunno yet
f2a40f
-       error - if an error was returned
f2a40f
-    """
f2a40f
-
f2a40f
-    options = (
f2a40f
-        ('--indent', dict(dest='indent', type=int, default=2,
f2a40f
-         help='Indention level of JSON output')),
f2a40f
-    )
f2a40f
-
f2a40f
-    def __init__(self, options):
f2a40f
-        super().__init__(options)
f2a40f
-        self.indent = options.indent
f2a40f
-
f2a40f
-    def generate(self, data):
f2a40f
-        output = []
f2a40f
-        for line in data:
f2a40f
-            kw = line.get('kw')
f2a40f
-            name = kw.get('name')
f2a40f
-            value = kw.get('value')
f2a40f
-            error = kw.get('error')
f2a40f
-
f2a40f
-            if value and error:
f2a40f
-                value = '%s: %s' % (error, value)
f2a40f
-            elif error:
f2a40f
-                value = error
f2a40f
-
f2a40f
-            rval = {'%s' % name: value}
f2a40f
-            output.append(rval)
5ff961
-
f2a40f
-        output = json.dumps(output, indent=self.indent)
f2a40f
-        if self.filename is None:
f2a40f
-            output += '\n'
f2a40f
-
f2a40f
-        return output
f2a40f
diff --git a/src/ipaclustercheck/ipa/__init__.py b/src/ipaclustercheck/ipa/__init__.py
f2a40f
deleted file mode 100644
f2a40f
index e69de29..0000000
f2a40f
diff --git a/src/ipaclustercheck/ipa/crlmanager.py b/src/ipaclustercheck/ipa/crlmanager.py
f2a40f
deleted file mode 100644
f2a40f
index 6806d74..0000000
f2a40f
--- a/src/ipaclustercheck/ipa/crlmanager.py
f2a40f
+++ /dev/null
f2a40f
@@ -1,36 +0,0 @@
f2a40f
-#
f2a40f
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
f2a40f
-#
f2a40f
-
f2a40f
-from ipaclustercheck.ipa.plugin import ClusterPlugin, registry, find_checks
f2a40f
-from ipahealthcheck.core.plugin import Result, duration
f2a40f
-from ipahealthcheck.core import constants
f2a40f
-
f2a40f
-
f2a40f
-@registry
f2a40f
-class ClusterCRLManagerCheck(ClusterPlugin):
f2a40f
-
f2a40f
-    @duration
f2a40f
-    def check(self):
f2a40f
-        data = self.registry.json
f2a40f
-        crlmanagers = []
f2a40f
-
f2a40f
-        for fqdn in data.keys():
f2a40f
-             output = find_checks(data[fqdn], 'ipahealthcheck.ipa.roles',
f2a40f
-                                 'IPACRLManagerCheck')
f2a40f
-             enabled = output[0].get('kw').get('crlgen_enabled')
f2a40f
-             if enabled:
f2a40f
-                 crlmanagers.append(fqdn)
f2a40f
-        if len(crlmanagers) == 0:
f2a40f
-            yield Result(self, constants.ERROR,
f2a40f
-                         name='crlmanager',
f2a40f
-                         error='No CRL Manager defined')
f2a40f
-        elif len(crlmanagers) == 1:
f2a40f
-            yield Result(self, constants.SUCCESS,
f2a40f
-                         name='crlmanager',
f2a40f
-                         value=crlmanagers[0])
f2a40f
-        else:
f2a40f
-            yield Result(self, constants.ERROR,
f2a40f
-                         name='crlmanager',
f2a40f
-                         value=','.join(crlmanagers),
f2a40f
-                         error='Multiple CRL Managers defined')
f2a40f
diff --git a/src/ipaclustercheck/ipa/plugin.py b/src/ipaclustercheck/ipa/plugin.py
f2a40f
deleted file mode 100644
5ff961
index a111988..0000000
f2a40f
--- a/src/ipaclustercheck/ipa/plugin.py
f2a40f
+++ /dev/null
f2a40f
@@ -1,117 +0,0 @@
f2a40f
-#
f2a40f
-# Copyright (C) 2020 FreeIPA Contributors see COPYING for license
f2a40f
-#
f2a40f
-
f2a40f
-from copy import deepcopy
f2a40f
-import json
f2a40f
-import logging
f2a40f
-from os import listdir
f2a40f
-from os.path import isfile, join
f2a40f
-
f2a40f
-from ipahealthcheck.core.plugin import Plugin, Registry
f2a40f
-from ipalib import api
f2a40f
-
f2a40f
-
f2a40f
-logger = logging.getLogger()
f2a40f
-
f2a40f
-def find_checks(data, source, check):
f2a40f
-    """Look through the dict for a matching source and check.
f2a40f
-
f2a40f
-       data: dict of source and check output
f2a40f
-       source: name of source to find
f2a40f
-       check: name of check to find
f2a40f
-
f2a40f
-       Returns list of contents of source + check or empty list
f2a40f
-    """
f2a40f
-    rval = []
f2a40f
-    for d in data:
f2a40f
-        if d.get('source') == source and d.get('check') == check:
f2a40f
-            rval.append(d)
f2a40f
-
f2a40f
-    return rval
f2a40f
-
f2a40f
-
f2a40f
-def get_masters(data):
f2a40f
-    """
f2a40f
-    Return the list of known masters
f2a40f
-
f2a40f
-    This is determined from the list of loaded healthcheck logs. It
f2a40f
-    is possible that mixed versions are used so some may not be
f2a40f
-    reporting the full list of masters, so check them all, and raise
f2a40f
-    an exception if the list cannot be determined.
f2a40f
-    """
f2a40f
-    test_masters = list(data)
f2a40f
-    masters = None
f2a40f
-    for master in test_masters:
f2a40f
-        output = find_checks(data[master], 'ipahealthcheck.ipa.meta',
f2a40f
-                             'IPAMetaCheck')
f2a40f
-        if len(output) == 0:
f2a40f
-            raise ValueError('Unable to determine full list of masters. '
f2a40f
-                             'ipahealthcheck.ipa.meta:IPAMetaCheck not '
f2a40f
-                             'found.')
f2a40f
-
f2a40f
-        masters = output[0].get('kw').get('masters')
f2a40f
-        if masters:
5ff961
-            return masters
f2a40f
-
f2a40f
-    raise ValueError('Unable to determine full list of masters. '
f2a40f
-                     'None of ipahealthcheck.ipa.meta:IPAMetaCheck '
f2a40f
-                     'contain masters.')
f2a40f
-
f2a40f
-
f2a40f
-class ClusterPlugin(Plugin):
f2a40f
-    pass
f2a40f
-
f2a40f
-
f2a40f
-class ClusterRegistry(Registry):
f2a40f
-    def __init__(self):
f2a40f
-        super().__init__()
f2a40f
-        self.json = None
f2a40f
-
f2a40f
-    def initialize(self, framework, config, options=None):
f2a40f
-        super().initialize(framework, config, options)
f2a40f
-
f2a40f
-        self.json = {}
f2a40f
-
f2a40f
-        self.load_files(options.dir)
f2a40f
-
f2a40f
-        if not api.isdone('finalize'):
f2a40f
-            if not api.isdone('bootstrap'):
f2a40f
-                api.bootstrap(in_server=True,
f2a40f
-                              context='ipahealthcheck',
f2a40f
-                              log=None)
f2a40f
-            if not api.isdone('finalize'):
f2a40f
-                api.finalize()
f2a40f
-
f2a40f
-    def load_files(self, dir):
f2a40f
-        if self.json:
f2a40f
-            return
f2a40f
-
f2a40f
-        files = [f for f in listdir(dir) if isfile(join(dir, f))]
f2a40f
-        for file in files:
f2a40f
-            fname = join(dir, file)
f2a40f
-            logger.debug("Reading %s", fname)
f2a40f
-            try:
f2a40f
-                with open(fname, 'r') as fd:
f2a40f
-                    data = fd.read()
f2a40f
-            except Exception as e:
f2a40f
-                logger.error("Unable to read %s: %s", fname, e)
f2a40f
-                continue
5ff961
-
f2a40f
-            try:
f2a40f
-                data = json.loads(data)
f2a40f
-            except Exception as e:
f2a40f
-                logger.error("Unable to parse JSON in %s: %s", fname, e)
f2a40f
-                continue
f2a40f
-
f2a40f
-            meta = find_checks(data, 'ipahealthcheck.meta.core',
f2a40f
-                                   'MetaCheck')
f2a40f
-            if meta:
f2a40f
-                fqdn = meta[0].get('kw').get('fqdn')
f2a40f
-                self.json[fqdn] = deepcopy(data)
f2a40f
-            else:
f2a40f
-                logger.error("No fqdn defined in JSON in %s", fname)
f2a40f
-                continue
5ff961
-
5ff961
-
f2a40f
-registry = ClusterRegistry()
f2a40f
diff --git a/src/ipaclustercheck/ipa/ruv.py b/src/ipaclustercheck/ipa/ruv.py
f2a40f
deleted file mode 100644
5ff961
index 6477738..0000000
f2a40f
--- a/src/ipaclustercheck/ipa/ruv.py
f2a40f
+++ /dev/null
f2a40f
@@ -1,155 +0,0 @@
f2a40f
-#
f2a40f
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
f2a40f
-#
f2a40f
-
f2a40f
-import logging
f2a40f
-
f2a40f
-from ipaclustercheck.ipa.plugin import (
f2a40f
-    ClusterPlugin,
f2a40f
-    registry,
f2a40f
-    find_checks,
f2a40f
-    get_masters
f2a40f
-)
f2a40f
-from ipahealthcheck.core.plugin import Result, duration
f2a40f
-from ipahealthcheck.core import constants
f2a40f
-from ipalib import api
f2a40f
-from ipapython.dn import DN
f2a40f
-
f2a40f
-
f2a40f
-logger = logging.getLogger()
f2a40f
-
f2a40f
-
f2a40f
-@registry
f2a40f
-class ClusterRUVCheck(ClusterPlugin):
f2a40f
-
f2a40f
-    # TODO: confirm that all masters are represented, otherwise the
f2a40f
-    #       trustworthiness of dangling RUV is mixed.
f2a40f
-    #
f2a40f
-    #       gah, need to provide full list of all masters in a check.
f2a40f
-
f2a40f
-    @duration
f2a40f
-    def check(self):
f2a40f
-        data = self.registry.json
f2a40f
-
f2a40f
-        # Start with the list of masters from the file(s) collected
f2a40f
-        # and find a MetaCheck with a full list of masters. For
f2a40f
-        # backwards compatibility.
f2a40f
-        try:
f2a40f
-            masters = get_masters(data)
f2a40f
-        except ValueError as e:
f2a40f
-            yield Result(self, constants.ERROR,
f2a40f
-                         name='dangling_ruv',
f2a40f
-                         error=str(e))
f2a40f
-            return
f2a40f
-
f2a40f
-        if len(data.keys()) < len(masters):
f2a40f
-            yield Result(self, constants.ERROR,
f2a40f
-                         name='dangling_ruv',
f2a40f
-                         error='Unable to determine list of RUVs, missing '
f2a40f
-                               'some masters: %s' %
f2a40f
-                               ''.join(set(masters) - set(data.keys())))
f2a40f
-            return
f2a40f
-
f2a40f
-        # collect the full set of known RUVs for each master
f2a40f
-        info = {}
f2a40f
-        for master in masters:
f2a40f
-            info[master] = {
f2a40f
-                'ca': False,           # does the host have ca configured?
f2a40f
-                'ruvs': set(),         # ruvs on the host
f2a40f
-                'csruvs': set(),       # csruvs on the host
f2a40f
-                'clean_ruv': set(),    # ruvs to be cleaned from the host
f2a40f
-                'clean_csruv': set()   # csruvs to be cleaned from the host
f2a40f
-                }
f2a40f
-
f2a40f
-        for fqdn in data.keys():
f2a40f
-            outputs = find_checks(data[fqdn], 'ipahealthcheck.ds.ruv',
f2a40f
-                                  'KnownRUVCheck')
f2a40f
-            for output in outputs:
f2a40f
-                if not 'suffix' in output.get('kw'):
f2a40f
-                    continue
f2a40f
-                basedn = DN(output.get('kw').get('suffix'))
f2a40f
-
f2a40f
-                ruvset = set()
f2a40f
-                ruvtmp = output.get('kw').get('ruvs')
f2a40f
-                for ruv in ruvtmp:
f2a40f
-                    ruvset.add(tuple(ruv))
f2a40f
-
f2a40f
-                if basedn == DN('o=ipaca'):
f2a40f
-                    info[fqdn]['ca'] = True
f2a40f
-                    info[fqdn]['csruvs'] = ruvset
f2a40f
-                elif basedn == api.env.basedn:
f2a40f
-                    info[fqdn]['ruvs'] = ruvset
f2a40f
-                else:
f2a40f
-                    yield Result(self, constants.WARNING,
f2a40f
-                                 name='dangling_ruv',
f2a40f
-                                 error='Unknown suffix found %s expected %s'
f2a40f
-                                       % (basedn, api.env.basedn))
f2a40f
-
f2a40f
-        # Collect the nsDS5ReplicaID for each master
f2a40f
-        ruvs = set()
f2a40f
-        csruvs = set()
f2a40f
-        for fqdn in data.keys():
f2a40f
-            outputs = find_checks(data[fqdn], 'ipahealthcheck.ds.ruv',
f2a40f
-                                  'RUVCheck')
f2a40f
-            for output in outputs:
f2a40f
-                if not 'key' in output.get('kw'):
f2a40f
-                    continue
f2a40f
-                basedn = DN(output.get('kw').get('key'))
f2a40f
-                ruv = (fqdn, (output.get('kw').get('ruv')))
f2a40f
-                if basedn == DN('o=ipaca'):
f2a40f
-                    csruvs.add(ruv)
f2a40f
-                elif basedn == api.env.basedn:
f2a40f
-                    ruvs.add(ruv)
f2a40f
-                else:
f2a40f
-                    yield Result(self, constants.WARNING,
f2a40f
-                                 name='dangling_ruv',
f2a40f
-                                 error='Unknown suffix found %s expected %s'
f2a40f
-                                       % (basedn, api.env.basedn))
f2a40f
-
f2a40f
-        dangles = False
f2a40f
-        # get the dangling RUVs
f2a40f
-        for master_info in info.values():
f2a40f
-            for ruv in master_info['ruvs']:
f2a40f
-                if ruv not in ruvs:
f2a40f
-                    master_info['clean_ruv'].add(ruv)
f2a40f
-                    dangles = True
f2a40f
-
f2a40f
-            # if ca is not configured, there will be no csruvs in master_info
f2a40f
-            for csruv in master_info['csruvs']:
f2a40f
-                if csruv not in csruvs:
f2a40f
-                    master_info['clean_csruv'].add(csruv)
f2a40f
-                    dangles = True
f2a40f
-
f2a40f
-        clean_csruvs = set()
f2a40f
-        clean_ruvs = set()
f2a40f
-        if dangles:
5ff961
-            for _unused, master_info in info.items():
f2a40f
-                for ruv in master_info['clean_ruv']:
f2a40f
-                    logger.debug(
f2a40f
-                        "Dangling RUV id: %s, hostname: %s", ruv[1], ruv[0]
f2a40f
-                    )
f2a40f
-                    clean_ruvs.add(ruv[1])
f2a40f
-                for csruv in master_info['clean_csruv']:
f2a40f
-                    logger.debug(
f2a40f
-                        "Dangling CS RUV id: %s, hostname: %s",
f2a40f
-                        csruv[1],
f2a40f
-                        csruv[0]
f2a40f
-                    )
f2a40f
-                    clean_csruvs.add(csruv[1])
f2a40f
-
f2a40f
-        if clean_ruvs:
f2a40f
-            yield Result(self, constants.ERROR,
f2a40f
-                         name='dangling_ruv',
f2a40f
-                         value=', '.join(clean_ruvs))
f2a40f
-        else:
f2a40f
-            yield Result(self, constants.SUCCESS,
f2a40f
-                         name='dangling_ruv',
f2a40f
-                         value='No dangling RUVs found')
f2a40f
-        if clean_csruvs:
f2a40f
-            yield Result(self, constants.ERROR,
f2a40f
-                         name='dangling_csruv',
f2a40f
-                         value=', '.join(clean_csruvs))
f2a40f
-        else:
f2a40f
-            yield Result(self, constants.SUCCESS,
f2a40f
-                         name='dangling_csruv',
f2a40f
-                         value='No dangling CS RUVs found')
f2a40f
diff --git a/tests/test_cluster_ruv.py b/tests/test_cluster_ruv.py
f2a40f
deleted file mode 100644
f2a40f
index 7583c84..0000000
f2a40f
--- a/tests/test_cluster_ruv.py
f2a40f
+++ /dev/null
f2a40f
@@ -1,106 +0,0 @@
f2a40f
-#
f2a40f
-# Copyright (C) 2019 FreeIPA Contributors see COPYING for license
f2a40f
-#
f2a40f
-
f2a40f
-from base import BaseTest
f2a40f
-from util import capture_results
f2a40f
-
f2a40f
-from ipahealthcheck.core import config
f2a40f
-from ipaclustercheck.ipa.plugin import ClusterRegistry
f2a40f
-from ipaclustercheck.ipa.ruv import ClusterRUVCheck
f2a40f
-
f2a40f
-import clusterdata
f2a40f
-
f2a40f
-
f2a40f
-class RUVRegistry(ClusterRegistry):
f2a40f
-    def load_files(self, dir):
f2a40f
-        self.json = dir
f2a40f
-
f2a40f
-
f2a40f
-class Options:
f2a40f
-    def __init__(self, data):
f2a40f
-        self.data = data
f2a40f
-
f2a40f
-    @property
f2a40f
-    def dir(self):
f2a40f
-        return self.data
f2a40f
-
f2a40f
-
f2a40f
-registry = RUVRegistry()
f2a40f
-
f2a40f
-
f2a40f
-class TestClusterRUV(BaseTest):
f2a40f
-
f2a40f
-    def test_no_ruvs(self):
f2a40f
-        """Single master test that has never created a replica
f2a40f
-
f2a40f
-           This type of master will have no RUVs created at all.
f2a40f
-        """
f2a40f
-        framework = object()
f2a40f
-        registry.initialize(framework, config.Config,
f2a40f
-                            Options(clusterdata.ONE_MASTER))
f2a40f
-        f = ClusterRUVCheck(registry)
f2a40f
-
f2a40f
-        self.results = capture_results(f)
f2a40f
-
f2a40f
-        assert len(self.results) == 2
f2a40f
-        result = self.results.results[0]
f2a40f
-        assert result.kw.get('name') == 'dangling_ruv'
f2a40f
-        assert result.kw.get('value') == 'No dangling RUVs found'
f2a40f
-        result = self.results.results[1]
f2a40f
-        assert result.kw.get('name') == 'dangling_csruv'
f2a40f
-        assert result.kw.get('value') == 'No dangling CS RUVs found'
f2a40f
-
f2a40f
-    def test_six_ruvs_ok(self):
f2a40f
-        """Three master test with each having a CA, no dangling
f2a40f
-        """
f2a40f
-        framework = object()
f2a40f
-        registry.initialize(framework, config.Config,
f2a40f
-                            Options(clusterdata.THREE_MASTERS_OK))
f2a40f
-        f = ClusterRUVCheck(registry)
f2a40f
-
f2a40f
-        self.results = capture_results(f)
f2a40f
-
f2a40f
-        assert len(self.results) == 2
f2a40f
-        result = self.results.results[0]
f2a40f
-        assert result.kw.get('name') == 'dangling_ruv'
f2a40f
-        assert result.kw.get('value') == 'No dangling RUVs found'
f2a40f
-        result = self.results.results[1]
f2a40f
-        assert result.kw.get('name') == 'dangling_csruv'
f2a40f
-        assert result.kw.get('value') == 'No dangling CS RUVs found'
f2a40f
-
f2a40f
-    def test_six_ruvs_ipa_bad(self):
f2a40f
-        """Three master test with each having a CA, dangling IPA RUV
f2a40f
-        """
f2a40f
-        framework = object()
f2a40f
-        registry.initialize(framework, config.Config,
f2a40f
-                            Options(clusterdata.THREE_MASTERS_BAD_IPA_RUV))
f2a40f
-        f = ClusterRUVCheck(registry)
f2a40f
-
f2a40f
-        self.results = capture_results(f)
f2a40f
-
f2a40f
-        assert len(self.results) == 2
f2a40f
-        result = self.results.results[0]
f2a40f
-        assert result.kw.get('name') == 'dangling_ruv'
f2a40f
-        assert result.kw.get('value') == '9'
f2a40f
-        result = self.results.results[1]
f2a40f
-        assert result.kw.get('name') == 'dangling_csruv'
f2a40f
-        assert result.kw.get('value') == 'No dangling CS RUVs found'
f2a40f
-
f2a40f
-    def test_six_ruvs_cs_bad(self):
f2a40f
-        """Three master test with each having a CA, dangling CA RUV
f2a40f
-        """
f2a40f
-        framework = object()
f2a40f
-        registry.initialize(framework, config.Config,
f2a40f
-                            Options(clusterdata.THREE_MASTERS_BAD_CS_RUV))
f2a40f
-        f = ClusterRUVCheck(registry)
f2a40f
-
f2a40f
-        self.results = capture_results(f)
f2a40f
-
f2a40f
-        assert len(self.results) == 2
f2a40f
-        result = self.results.results[0]
f2a40f
-        assert result.kw.get('name') == 'dangling_ruv'
f2a40f
-        assert result.kw.get('value') == 'No dangling RUVs found'
f2a40f
-        result = self.results.results[1]
f2a40f
-        assert result.kw.get('name') == 'dangling_csruv'
f2a40f
-        assert result.kw.get('value') == '9'
f2a40f
-- 
5ff961
2.38.1
f2a40f