From 3372ad2766c0d182fa88c8bc28cf43477dc4cb3b Mon Sep 17 00:00:00 2001 From: Tomas Krizek Date: Feb 21 2017 16:09:00 +0000 Subject: Add fips_mode variable to env Variable fips_mode indicating whether machine is running in FIPS-enabled mode was added to env. https://fedorahosted.org/freeipa/ticket/5695 Reviewed-By: Martin Basti Reviewed-By: Jan Cholasta Reviewed-By: Stanislav Laznicka --- diff --git a/ipalib/config.py b/ipalib/config.py index 1a59879..388ffe8 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -47,6 +47,10 @@ from ipalib.constants import ( TLS_VERSIONS ) from ipalib import errors +try: + from ipaplatform.tasks import tasks +except ImportError: + tasks = None if six.PY3: unicode = str @@ -443,6 +447,10 @@ class Env(object): self.bin = path.dirname(self.script) self.home = os.environ.get('HOME', None) + # Set fips_mode only if ipaplatform module was loaded + if tasks is not None: + self.fips_mode = tasks.is_fips_enabled() + # Merge in overrides: self._merge(**overrides)