From 1fccdd00d53bc71e87ab5a4b1c68ab6e3efcce8c Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Mar 11 2020 08:38:33 +0000 Subject: ipa-adtrust-install: remote command fails if ipa-server-trust-ad pkg missing When the command ipa-adtrust-install --add-agents is run, it executes remotely the command trust_enable_agent. This command does not require the package ipa-server-trust-ad to be installed on the remote node, but fails if it's not the case because dbus is not imported. Need to move the "import dbus" outside of the try/except related to dcerpc import. Related: https://pagure.io/freeipa/issue/7600 Reviewed-By: Alexander Bokovoy Reviewed-By: Christian Heimes Reviewed-By: Christian Heimes Reviewed-By: Alexander Bokovoy --- diff --git a/ipaserver/plugins/trust.py b/ipaserver/plugins/trust.py index 743d61f..6fc3686 100644 --- a/ipaserver/plugins/trust.py +++ b/ipaserver/plugins/trust.py @@ -18,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import dbus +import dbus.mainloop.glib import logging import six @@ -74,8 +76,6 @@ except Exception as e: if api.env.in_server and api.env.context in ['lite', 'server']: try: import ipaserver.dcerpc - import dbus - import dbus.mainloop.glib _bindings_installed = True except ImportError: _bindings_installed = False