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 <mbasti@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
Tomas Krizek 2017-02-06 13:08:11 +01:00 committed by Martin Basti
parent cc446fb448
commit 3372ad2766

View File

@ -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)