Example #1
0
    def raise_if_unsupported(self, exc, message="Unsupported package manager"):
        """Check if the package manager is supported else raise exc.

        Use case::

            pm = PackageManager(cfg)
            pm.raise_if_unsupported(unittest.SkipTest, 'Test requires yum/dnf')
            # will raise and skip if not yum or dnf
            pm.install('foobar')

        """
        try:
            self.name
        except exceptions.NoKnownPackageManagerError as e:
            logger.exception(e)
            raise exc(message)
Example #2
0
    def raise_if_unsupported(self, exc, message="Unsupported registry client"):
        """Check if the registry client is supported else raise exc.

        Use case::

            rc = RegistryClient(cfg)
            rc.raise_if_unsupported(unittest.SkipTest, 'Test requires podman')
            # will raise and skip if not podman or docker
            rc.pull('busybox')

        """
        try:
            self.name
        except exceptions.NoRegistryClientError as e:
            logger.exception(e)
            raise exc(message)
Example #3
0
def fips_is_supported(cfg, pulp_host=None):
    """Return ``True`` if the server supports Fips, or ``False`` otherwise.

    :param pulp_smash.config.PulpSmashConfig cfg: Information about the system
        being targeted
    :param pulp_host: A :class : `pulp_smash.config.PulpHost` to target,
        instead of the default chosen by :class: pulp_smash.cli.Client`.
    :return: True of False
    """
    try:
        cli.Client(cfg, pulp_host=pulp_host).run(
            ("sysctl", "crypto.fips_enabled"))
    except exceptions.CalledProcessError as e:
        logger.exception(e)
        return False
    return True