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 <abokovoy@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2020-03-10 15:26:49 +01:00
parent e01e7fe6c6
commit 233a18b2a2

View File

@ -18,6 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
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