support using trust-related operations in the server console

When using `ipa -e in_server=True console` on IPA master, the whole IPA
framework is loaded in the same process ('ipa console'). The context
defined for this configuration is 'cli'. Some trust-related operations
need to load Samba bindings and guard itself to 'lite' and 'server'
contexts.

Upon reviewing these cases I came to conclusion that these guards are
unnecessary. It is enough to require that the context is in the server
code.

Allow these operations if we are operating in server mode. This allows
to debug trust-related issued directly in the IPA console on IPA trust
controllers.

Signed-of-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Alexander Bokovoy 2020-06-03 12:47:41 +03:00 committed by Rob Crittenden
parent 28389fe8af
commit ecc0a96d16
5 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ if six.PY3:
logger = logging.getLogger(__name__)
if api.env.in_server and api.env.context in ['lite', 'server']:
if api.env.in_server:
try:
import ipaserver.dcerpc
_dcerpc_bindings_installed = True

View File

@ -24,7 +24,7 @@ from ipalib import Command, Str, Flag, Int
from ipalib import _
from ipapython.dn import DN
from ipalib.plugable import Registry
if api.env.in_server and api.env.context in ['lite', 'server']:
if api.env.in_server:
try:
import ipaserver.dcerpc
_dcerpc_bindings_installed = True

View File

@ -30,7 +30,7 @@ from ipapython.dn import DN
if six.PY3:
unicode = str
if api.env.in_server and api.env.context in ['lite', 'server']:
if api.env.in_server:
try:
import ipaserver.dcerpc
_dcerpc_bindings_installed = True

View File

@ -49,7 +49,7 @@ if six.PY3:
_dcerpc_bindings_installed = False
if api.env.in_server and api.env.context in ['lite', 'server']:
if api.env.in_server:
try:
import ipaserver.dcerpc
_dcerpc_bindings_installed = True

View File

@ -73,7 +73,7 @@ try:
except Exception as e:
_nss_idmap_installed = False
if api.env.in_server and api.env.context in ['lite', 'server']:
if api.env.in_server:
try:
import ipaserver.dcerpc
_bindings_installed = True