86baa9
From f4995135a97531819503632e72f9910101f5ce61 Mon Sep 17 00:00:00 2001
86baa9
From: Christian Heimes <cheimes@redhat.com>
86baa9
Date: Wed, 7 Feb 2018 17:18:07 +0100
86baa9
Subject: [PATCH] Replace hard-coded paths with path constants
86baa9
86baa9
Several run() calls used hard-coded paths rather than pre-defined paths
86baa9
from ipaplatform.paths. The patch fixes all places that I was able to
86baa9
find with a simple search.
86baa9
86baa9
The fix simplifies Darix's port of freeIPA on openSuSE.
86baa9
86baa9
Signed-off-by: Christian Heimes <cheimes@redhat.com>
86baa9
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
86baa9
(cherry picked from commit 2391c75e3d7efcdc5c2f49defa5138fc7e6def06)
86baa9
86baa9
Reviewed-By: Christian Heimes <cheimes@redhat.com>
86baa9
---
86baa9
 client/ipa-client-automount                   |  2 +-
86baa9
 install/tools/ipa-adtrust-install             |  2 +-
86baa9
 install/tools/ipa-ca-install                  |  2 +-
86baa9
 install/tools/ipa-dns-install                 |  2 +-
86baa9
 ipaclient/install/client.py                   | 10 ++++----
86baa9
 ipaplatform/base/paths.py                     |  8 +++++++
86baa9
 ipapython/kernel_keyring.py                   | 24 +++++++++++++------
86baa9
 ipaserver/install/adtrustinstance.py          |  6 +++--
86baa9
 ipaserver/install/installutils.py             | 17 +++++++++----
86baa9
 ipaserver/install/ipa_backup.py               |  6 ++---
86baa9
 ipaserver/install/ipa_restore.py              |  4 ++--
86baa9
 ipaserver/install/krbinstance.py              |  2 +-
86baa9
 ipatests/pytest_ipa/integration/__init__.py   |  3 ++-
86baa9
 ipatests/test_integration/test_caless.py      |  2 +-
86baa9
 ipatests/test_ipapython/test_ipautil.py       | 15 ++++++------
86baa9
 .../test_caacl_profile_enforcement.py         |  3 ++-
86baa9
 ipatests/test_xmlrpc/test_cert_plugin.py      |  2 +-
86baa9
 17 files changed, 70 insertions(+), 40 deletions(-)
86baa9
86baa9
diff --git a/client/ipa-client-automount b/client/ipa-client-automount
86baa9
index ee55d655c9531c8fb7baebd0e7a99f3db484f7db..6c2816c410642967e95a7b1eb60583600a7f5fb0 100755
86baa9
--- a/client/ipa-client-automount
86baa9
+++ b/client/ipa-client-automount
86baa9
@@ -92,7 +92,7 @@ def wait_for_sssd():
86baa9
     time.sleep(1)
86baa9
     while n < 10 and not found:
86baa9
         try:
86baa9
-            ipautil.run(["getent", "passwd", "admin@%s" % api.env.realm])
86baa9
+            ipautil.run([paths.GETENT, "passwd", "admin@%s" % api.env.realm])
86baa9
             found = True
86baa9
         except Exception:
86baa9
             time.sleep(1)
86baa9
diff --git a/install/tools/ipa-adtrust-install b/install/tools/ipa-adtrust-install
86baa9
index a870d136e242affe6627cd4c44a173a80a9ab1c6..9dbfadb6fae193e2f4a54b3a0e226e0a6b1fd26f 100755
86baa9
--- a/install/tools/ipa-adtrust-install
86baa9
+++ b/install/tools/ipa-adtrust-install
86baa9
@@ -110,7 +110,7 @@ def read_admin_password(admin_name):
86baa9
 
86baa9
 def ensure_admin_kinit(admin_name, admin_password):
86baa9
     try:
86baa9
-        ipautil.run(['kinit', admin_name], stdin=admin_password+'\n')
86baa9
+        ipautil.run([paths.KINIT, admin_name], stdin=admin_password+'\n')
86baa9
     except ipautil.CalledProcessError:
86baa9
         print("There was error to automatically re-kinit your admin user "
86baa9
               "ticket.")
86baa9
diff --git a/install/tools/ipa-ca-install b/install/tools/ipa-ca-install
86baa9
index dcdbe884f15b13b92ec68a11d9f00e3e28771b42..55182dc30e4736618f749e78db161fc7eefe37ac 100755
86baa9
--- a/install/tools/ipa-ca-install
86baa9
+++ b/install/tools/ipa-ca-install
86baa9
@@ -352,7 +352,7 @@ def main():
86baa9
     api.Backend.ldap2.disconnect()
86baa9
 
86baa9
     # execute ipactl to refresh services status
86baa9
-    ipautil.run(['ipactl', 'start', '--ignore-service-failures'],
86baa9
+    ipautil.run([paths.IPACTL, 'start', '--ignore-service-failures'],
86baa9
                 raiseonerr=False)
86baa9
 
86baa9
 
86baa9
diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
86baa9
index 32a17d223ae2bdd9a1ded62defcc272a40d2627b..0e76a5ab93bd37c2f0c9c5ea4894023588697782 100755
86baa9
--- a/install/tools/ipa-dns-install
86baa9
+++ b/install/tools/ipa-dns-install
86baa9
@@ -151,7 +151,7 @@ def main():
86baa9
     # Services are enabled in dns_installer.install()
86baa9
 
86baa9
     # execute ipactl to refresh services status
86baa9
-    ipautil.run(['ipactl', 'start', '--ignore-service-failures'],
86baa9
+    ipautil.run([paths.IPACTL, 'start', '--ignore-service-failures'],
86baa9
                 raiseonerr=False)
86baa9
 
86baa9
     api.Backend.ldap2.disconnect()
86baa9
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
86baa9
index 80b572ce9b5a250c0c32a1d7fcd06ec53af32984..babebfc667c5a096fb2e0238de444ffa3ce62b77 100644
86baa9
--- a/ipaclient/install/client.py
86baa9
+++ b/ipaclient/install/client.py
86baa9
@@ -1125,7 +1125,7 @@ def configure_sshd_config(fstore, options):
86baa9
         )
86baa9
 
86baa9
         for candidate in candidates:
86baa9
-            args = ['sshd', '-t', '-f', os.devnull]
86baa9
+            args = [paths.SSHD, '-t', '-f', os.devnull]
86baa9
             for item in candidate.items():
86baa9
                 args.append('-o')
86baa9
                 args.append('%s=%s' % item)
86baa9
@@ -1157,7 +1157,7 @@ def configure_automount(options):
86baa9
     logger.info('\nConfiguring automount:')
86baa9
 
86baa9
     args = [
86baa9
-        'ipa-client-automount', '--debug', '-U', '--location',
86baa9
+        paths.IPA_CLIENT_AUTOMOUNT, '--debug', '-U', '--location',
86baa9
         options.location
86baa9
     ]
86baa9
 
86baa9
@@ -2615,7 +2615,7 @@ def _install(options):
86baa9
                 subject_base = DN(subject_base)
86baa9
 
86baa9
             if options.principal is not None:
86baa9
-                run(["kdestroy"], raiseonerr=False, env=env)
86baa9
+                run([paths.KDESTROY], raiseonerr=False, env=env)
86baa9
 
86baa9
             # Obtain the TGT. We do it with the temporary krb5.conf, so that
86baa9
             # only the KDC we're installing under is contacted.
86baa9
@@ -2954,7 +2954,7 @@ def _install(options):
86baa9
             # Particulary, SSSD might take longer than 6-8 seconds.
86baa9
             while n < 10 and not found:
86baa9
                 try:
86baa9
-                    ipautil.run(["getent", "passwd", user])
86baa9
+                    ipautil.run([paths.GETENT, "passwd", user])
86baa9
                     found = True
86baa9
                 except Exception as e:
86baa9
                     time.sleep(1)
86baa9
@@ -3036,7 +3036,7 @@ def uninstall(options):
86baa9
     statestore = sysrestore.StateFile(paths.IPA_CLIENT_SYSRESTORE)
86baa9
 
86baa9
     try:
86baa9
-        run(["ipa-client-automount", "--uninstall", "--debug"])
86baa9
+        run([paths.IPA_CLIENT_AUTOMOUNT, "--uninstall", "--debug"])
86baa9
     except Exception as e:
86baa9
         logger.error(
86baa9
             "Unconfigured automount client failed: %s", str(e))
86baa9
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
86baa9
index f1327daa11840bb9416cb0a12f2b5a1300b0374b..435d1b7de9083ee74e80da6fef5c3e3cdad654bb 100644
86baa9
--- a/ipaplatform/base/paths.py
86baa9
+++ b/ipaplatform/base/paths.py
86baa9
@@ -25,6 +25,8 @@ This base platform module exports default filesystem paths.
86baa9
 class BasePathNamespace(object):
86baa9
     BASH = "/bin/bash"
86baa9
     BIN_HOSTNAMECTL = "/bin/hostnamectl"
86baa9
+    ECHO = "/bin/echo"
86baa9
+    GZIP = "/usr/bin/gzip"
86baa9
     LS = "/bin/ls"
86baa9
     SH = "/bin/sh"
86baa9
     SYSTEMCTL = "/bin/systemctl"
86baa9
@@ -160,8 +162,10 @@ class BasePathNamespace(object):
86baa9
     GPG = "/usr/bin/gpg"
86baa9
     GPG_AGENT = "/usr/bin/gpg-agent"
86baa9
     IPA_GETCERT = "/usr/bin/ipa-getcert"
86baa9
+    KADMIN_LOCAL = '/usr/sbin/kadmin.local'
86baa9
     KDESTROY = "/usr/bin/kdestroy"
86baa9
     KINIT = "/usr/bin/kinit"
86baa9
+    KLIST = "/usr/bin/klist"
86baa9
     BIN_KVNO = "/usr/bin/kvno"
86baa9
     LDAPMODIFY = "/usr/bin/ldapmodify"
86baa9
     LDAPPASSWD = "/usr/bin/ldappasswd"
86baa9
@@ -207,6 +211,7 @@ class BasePathNamespace(object):
86baa9
     GROUPADD = "/usr/sbin/groupadd"
86baa9
     USERMOD = "/usr/sbin/usermod"
86baa9
     HTTPD = "/usr/sbin/httpd"
86baa9
+    IPA_CLIENT_AUTOMOUNT = "/usr/sbin/ipa-client-automount"
86baa9
     IPA_CLIENT_INSTALL = "/usr/sbin/ipa-client-install"
86baa9
     IPA_DNS_INSTALL = "/usr/sbin/ipa-dns-install"
86baa9
     SBIN_IPA_JOIN = "/usr/sbin/ipa-join"
86baa9
@@ -362,6 +367,9 @@ class BasePathNamespace(object):
86baa9
     IF_INET6 = '/proc/net/if_inet6'
86baa9
     AUTHCONFIG = None
86baa9
     IPA_SERVER_UPGRADE = '/usr/sbin/ipa-server-upgrade'
86baa9
+    KEYCTL = '/usr/bin/keyctl'
86baa9
+    GETENT = '/usr/bin/getent'
86baa9
+    SSHD = '/usr/sbin/sshd'
86baa9
 
86baa9
 
86baa9
 paths = BasePathNamespace()
86baa9
diff --git a/ipapython/kernel_keyring.py b/ipapython/kernel_keyring.py
86baa9
index 4b7010e32e90a52fefb0ebbd4fec930ae82b7ea6..6ae1e74493810fa25093fe134447dd4ba0f5da74 100644
86baa9
--- a/ipapython/kernel_keyring.py
86baa9
+++ b/ipapython/kernel_keyring.py
86baa9
@@ -23,6 +23,7 @@ import os
86baa9
 import six
86baa9
 
86baa9
 from ipapython.ipautil import run
86baa9
+from ipaplatform.paths import paths
86baa9
 
86baa9
 # NOTE: Absolute path not required for keyctl since we reset the environment
86baa9
 #       in ipautil.run.
86baa9
@@ -35,34 +36,38 @@ from ipapython.ipautil import run
86baa9
 KEYRING = '@s'
86baa9
 KEYTYPE = 'user'
86baa9
 
86baa9
+
86baa9
 def dump_keys():
86baa9
     """
86baa9
     Dump all keys
86baa9
     """
86baa9
-    result = run(['keyctl', 'list', KEYRING], raiseonerr=False,
86baa9
+    result = run([paths.KEYCTL, 'list', KEYRING], raiseonerr=False,
86baa9
                  capture_output=True)
86baa9
     return result.output
86baa9
 
86baa9
+
86baa9
 def get_real_key(key):
86baa9
     """
86baa9
     One cannot request a key based on the description it was created with
86baa9
     so find the one we're looking for.
86baa9
     """
86baa9
     assert isinstance(key, six.string_types)
86baa9
-    result = run(['keyctl', 'search', KEYRING, KEYTYPE, key],
86baa9
+    result = run([paths.KEYCTL, 'search', KEYRING, KEYTYPE, key],
86baa9
                  raiseonerr=False, capture_output=True)
86baa9
     if result.returncode:
86baa9
         raise ValueError('key %s not found' % key)
86baa9
     return result.raw_output.rstrip()
86baa9
 
86baa9
+
86baa9
 def get_persistent_key(key):
86baa9
     assert isinstance(key, six.string_types)
86baa9
-    result = run(['keyctl', 'get_persistent', KEYRING, key],
86baa9
+    result = run([paths.KEYCTL, 'get_persistent', KEYRING, key],
86baa9
                  raiseonerr=False, capture_output=True)
86baa9
     if result.returncode:
86baa9
         raise ValueError('persistent key %s not found' % key)
86baa9
     return result.raw_output.rstrip()
86baa9
 
86baa9
+
86baa9
 def is_persistent_keyring_supported():
86baa9
     uid = os.geteuid()
86baa9
     try:
86baa9
@@ -72,6 +77,7 @@ def is_persistent_keyring_supported():
86baa9
 
86baa9
     return True
86baa9
 
86baa9
+
86baa9
 def has_key(key):
86baa9
     """
86baa9
     Returns True/False whether the key exists in the keyring.
86baa9
@@ -83,6 +89,7 @@ def has_key(key):
86baa9
     except ValueError:
86baa9
         return False
86baa9
 
86baa9
+
86baa9
 def read_key(key):
86baa9
     """
86baa9
     Read the keyring and return the value for key.
86baa9
@@ -91,13 +98,14 @@ def read_key(key):
86baa9
     """
86baa9
     assert isinstance(key, six.string_types)
86baa9
     real_key = get_real_key(key)
86baa9
-    result = run(['keyctl', 'pipe', real_key], raiseonerr=False,
86baa9
+    result = run([paths.KEYCTL, 'pipe', real_key], raiseonerr=False,
86baa9
                  capture_output=True)
86baa9
     if result.returncode:
86baa9
         raise ValueError('keyctl pipe failed: %s' % result.error_log)
86baa9
 
86baa9
     return result.raw_output
86baa9
 
86baa9
+
86baa9
 def update_key(key, value):
86baa9
     """
86baa9
     Update the keyring data. If they key doesn't exist it is created.
86baa9
@@ -106,13 +114,14 @@ def update_key(key, value):
86baa9
     assert isinstance(value, bytes)
86baa9
     if has_key(key):
86baa9
         real_key = get_real_key(key)
86baa9
-        result = run(['keyctl', 'pupdate', real_key], stdin=value,
86baa9
+        result = run([paths.KEYCTL, 'pupdate', real_key], stdin=value,
86baa9
                      raiseonerr=False)
86baa9
         if result.returncode:
86baa9
             raise ValueError('keyctl pupdate failed: %s' % result.error_log)
86baa9
     else:
86baa9
         add_key(key, value)
86baa9
 
86baa9
+
86baa9
 def add_key(key, value):
86baa9
     """
86baa9
     Add a key to the kernel keyring.
86baa9
@@ -121,18 +130,19 @@ def add_key(key, value):
86baa9
     assert isinstance(value, bytes)
86baa9
     if has_key(key):
86baa9
         raise ValueError('key %s already exists' % key)
86baa9
-    result = run(['keyctl', 'padd', KEYTYPE, key, KEYRING],
86baa9
+    result = run([paths.KEYCTL, 'padd', KEYTYPE, key, KEYRING],
86baa9
                  stdin=value, raiseonerr=False)
86baa9
     if result.returncode:
86baa9
         raise ValueError('keyctl padd failed: %s' % result.error_log)
86baa9
 
86baa9
+
86baa9
 def del_key(key):
86baa9
     """
86baa9
     Remove a key from the keyring
86baa9
     """
86baa9
     assert isinstance(key, six.string_types)
86baa9
     real_key = get_real_key(key)
86baa9
-    result = run(['keyctl', 'unlink', real_key, KEYRING],
86baa9
+    result = run([paths.KEYCTL, 'unlink', real_key, KEYRING],
86baa9
                  raiseonerr=False)
86baa9
     if result.returncode:
86baa9
         raise ValueError('keyctl unlink failed: %s' % result.error_log)
86baa9
diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
86baa9
index 1f875c26fe909428ebf2e9c2acc9a8ad70de9a72..e787fccb9482809b180012ed8e7be2e5a6494f93 100644
86baa9
--- a/ipaserver/install/adtrustinstance.py
86baa9
+++ b/ipaserver/install/adtrustinstance.py
86baa9
@@ -555,8 +555,10 @@ class ADTRUSTInstance(service.Service):
86baa9
     def clean_samba_keytab(self):
86baa9
         if os.path.exists(self.keytab):
86baa9
             try:
86baa9
-                ipautil.run(["ipa-rmkeytab", "--principal", self.principal,
86baa9
-                             "-k", self.keytab])
86baa9
+                ipautil.run([
86baa9
+                    paths.IPA_RMKEYTAB, "--principal", self.principal,
86baa9
+                    "-k", self.keytab
86baa9
+                ])
86baa9
             except ipautil.CalledProcessError as e:
86baa9
                 if e.returncode != 5:
86baa9
                     logger.critical("Failed to remove old key for %s",
86baa9
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py
86baa9
index 005fbeef37309ee3891e82ac0727adb031213da6..e110a5c3fc3e214736cb650f6da8a330eaa665a2 100644
86baa9
--- a/ipaserver/install/installutils.py
86baa9
+++ b/ipaserver/install/installutils.py
86baa9
@@ -599,19 +599,26 @@ def get_directive(filename, directive, separator=' '):
86baa9
     fd.close()
86baa9
     return None
86baa9
 
86baa9
+
86baa9
 def kadmin(command):
86baa9
-    return ipautil.run(["kadmin.local", "-q", command,
86baa9
-                        "-x", "ipa-setup-override-restrictions"],
86baa9
-                       capture_output=True,
86baa9
-                       capture_error=True)
86baa9
+    return ipautil.run(
86baa9
+        [
86baa9
+            paths.KADMIN_LOCAL, "-q", command,
86baa9
+            "-x", "ipa-setup-override-restrictions"
86baa9
+        ],
86baa9
+        capture_output=True,
86baa9
+        capture_error=True
86baa9
+    )
86baa9
 
86baa9
 
86baa9
 def kadmin_addprinc(principal):
86baa9
     return kadmin("addprinc -randkey " + principal)
86baa9
 
86baa9
+
86baa9
 def kadmin_modprinc(principal, options):
86baa9
     return kadmin("modprinc " + options + " " + principal)
86baa9
 
86baa9
+
86baa9
 def create_keytab(path, principal):
86baa9
     try:
86baa9
         if os.path.isfile(path):
86baa9
@@ -832,7 +839,7 @@ def expand_replica_info(filename, password):
86baa9
     tarfile = top_dir+"/files.tar"
86baa9
     dir_path = top_dir + "/realm_info"
86baa9
     decrypt_file(filename, tarfile, password, top_dir)
86baa9
-    ipautil.run(["tar", "xf", tarfile, "-C", top_dir])
86baa9
+    ipautil.run([paths.TAR, "xf", tarfile, "-C", top_dir])
86baa9
     os.remove(tarfile)
86baa9
 
86baa9
     return top_dir, dir_path
86baa9
diff --git a/ipaserver/install/ipa_backup.py b/ipaserver/install/ipa_backup.py
86baa9
index cef01d30454ea1adb8bf9c68f428b9555f1b9557..db4b28c6deebd833855c32c5ff832dad3e5c741e 100644
86baa9
--- a/ipaserver/install/ipa_backup.py
86baa9
+++ b/ipaserver/install/ipa_backup.py
86baa9
@@ -314,7 +314,7 @@ class Backup(admintool.AdminTool):
86baa9
                     dirsrv.stop(capture_output=False)
86baa9
             else:
86baa9
                 logger.info('Stopping IPA services')
86baa9
-                run(['ipactl', 'stop'])
86baa9
+                run([paths.IPACTL, 'stop'])
86baa9
 
86baa9
             instance = installutils.realm_to_serverid(api.env.realm)
86baa9
             if os.path.exists(paths.VAR_LIB_SLAPD_INSTANCE_DIR_TEMPLATE %
86baa9
@@ -336,7 +336,7 @@ class Backup(admintool.AdminTool):
86baa9
                     dirsrv.start(capture_output=False)
86baa9
             else:
86baa9
                 logger.info('Starting IPA service')
86baa9
-                run(['ipactl', 'start'])
86baa9
+                run([paths.IPACTL, 'start'])
86baa9
 
86baa9
             # Compress after services are restarted to minimize
86baa9
             # the unavailability window
86baa9
@@ -549,7 +549,7 @@ class Backup(admintool.AdminTool):
86baa9
         # Compress the archive. This is done separately, since 'tar' cannot
86baa9
         # append to a compressed archive.
86baa9
         if self.tarfile:
86baa9
-            result = run(['gzip', self.tarfile], raiseonerr=False)
86baa9
+            result = run([paths.GZIP, self.tarfile], raiseonerr=False)
86baa9
             if result.returncode != 0:
86baa9
                 raise admintool.ScriptError(
86baa9
                     'gzip returned non-zero code %d '
86baa9
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
86baa9
index c7e996bbe284a7eb2d03fbedb4798d3b15f3dcc0..4941831585f473c4937b23b3f59d8ff99a654b0e 100644
86baa9
--- a/ipaserver/install/ipa_restore.py
86baa9
+++ b/ipaserver/install/ipa_restore.py
86baa9
@@ -386,7 +386,7 @@ class Restore(admintool.AdminTool):
86baa9
                     dirsrv.start(capture_output=False)
86baa9
             else:
86baa9
                 logger.info('Stopping IPA services')
86baa9
-                result = run(['ipactl', 'stop'], raiseonerr=False)
86baa9
+                result = run([paths.IPACTL, 'stop'], raiseonerr=False)
86baa9
                 if result.returncode not in [0, 6]:
86baa9
                     logger.warning('Stopping IPA failed: %s', result.error_log)
86baa9
 
86baa9
@@ -426,7 +426,7 @@ class Restore(admintool.AdminTool):
86baa9
                 gssproxy = services.service('gssproxy', api)
86baa9
                 gssproxy.reload_or_restart()
86baa9
                 logger.info('Starting IPA services')
86baa9
-                run(['ipactl', 'start'])
86baa9
+                run([paths.IPACTL, 'start'])
86baa9
                 logger.info('Restarting SSSD')
86baa9
                 sssd = services.service('sssd', api)
86baa9
                 sssd.restart()
86baa9
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
86baa9
index 319eeb82bcbe61acd70b2943982b6fec6fa33f92..139803ffbe26a6197535e66b63ba566c2a917e01 100644
86baa9
--- a/ipaserver/install/krbinstance.py
86baa9
+++ b/ipaserver/install/krbinstance.py
86baa9
@@ -346,7 +346,7 @@ class KrbInstance(service.Service):
86baa9
         MIN_KRB5KDC_WITH_WORKERS = "1.9"
86baa9
         cpus = os.sysconf('SC_NPROCESSORS_ONLN')
86baa9
         workers = False
86baa9
-        result = ipautil.run(['klist', '-V'],
86baa9
+        result = ipautil.run([paths.KLIST, '-V'],
86baa9
                              raiseonerr=False, capture_output=True)
86baa9
         if result.returncode == 0:
86baa9
             verstr = result.output.split()[-1]
86baa9
diff --git a/ipatests/pytest_ipa/integration/__init__.py b/ipatests/pytest_ipa/integration/__init__.py
86baa9
index fb9990a15b8e28dbe27f2b9275e4877e00f25755..7c1eb2232e2362b8f691329d9a022391a0e79d91 100644
86baa9
--- a/ipatests/pytest_ipa/integration/__init__.py
86baa9
+++ b/ipatests/pytest_ipa/integration/__init__.py
86baa9
@@ -31,6 +31,7 @@ import pytest
86baa9
 from pytest_multihost import make_multihost_fixture
86baa9
 
86baa9
 from ipapython import ipautil
86baa9
+from ipaplatform.paths import paths
86baa9
 from ipatests.test_util import yield_fixture
86baa9
 from .config import Config
86baa9
 from .env_config import get_global_config
86baa9
@@ -150,7 +151,7 @@ def collect_logs(name, logs_dict, logfile_dir=None, beakerlib_plugin=None):
86baa9
             # delete from remote
86baa9
             host.run_command(['rm', '-f', tmpname])
86baa9
             # Unpack on the local side
86baa9
-            ipautil.run(['tar', 'xJvf', 'logs.tar.xz'], cwd=dirname,
86baa9
+            ipautil.run([paths.TAR, 'xJvf', 'logs.tar.xz'], cwd=dirname,
86baa9
                         raiseonerr=False)
86baa9
             os.unlink(tarname)
86baa9
 
86baa9
diff --git a/ipatests/test_integration/test_caless.py b/ipatests/test_integration/test_caless.py
86baa9
index f93bdc976e03e23536c4cb2dc7401d44ddddcea1..ff8d95caa6fed00d3876f1d08e2170a9587a6d86 100644
86baa9
--- a/ipatests/test_integration/test_caless.py
86baa9
+++ b/ipatests/test_integration/test_caless.py
86baa9
@@ -336,7 +336,7 @@ class CALessBase(IntegrationTest):
86baa9
                 with open(cert_fname) as cert:
86baa9
                     chain.write(cert.read())
86baa9
 
86baa9
-        ipautil.run(["openssl", "pkcs12", "-export", "-out", filename,
86baa9
+        ipautil.run([paths.OPENSSL, "pkcs12", "-export", "-out", filename,
86baa9
                      "-inkey", key_fname, "-in", certchain_fname, "-passin",
86baa9
                      "pass:" + cls.cert_password, "-passout", "pass:" +
86baa9
                      password, "-name", nickname], cwd=cls.cert_dir)
86baa9
diff --git a/ipatests/test_ipapython/test_ipautil.py b/ipatests/test_ipapython/test_ipautil.py
86baa9
index e15b4f948e8c6f927ee5594780609dace0345d28..88b591e5cb173799c2d5dffddadcfe65958b7c6b 100644
86baa9
--- a/ipatests/test_ipapython/test_ipautil.py
86baa9
+++ b/ipatests/test_ipapython/test_ipautil.py
86baa9
@@ -30,6 +30,7 @@ import pytest
86baa9
 import six
86baa9
 import tempfile
86baa9
 
86baa9
+from ipaplatform.paths import paths
86baa9
 from ipalib.constants import IPAAPI_USER
86baa9
 from ipapython import ipautil
86baa9
 
86baa9
@@ -419,7 +420,7 @@ class TestTimeParser(object):
86baa9
 
86baa9
 
86baa9
 def test_run():
86baa9
-    result = ipautil.run(['echo', 'foo\x02bar'],
86baa9
+    result = ipautil.run([paths.ECHO, 'foo\x02bar'],
86baa9
                          capture_output=True,
86baa9
                          capture_error=True)
86baa9
     assert result.returncode == 0
86baa9
@@ -430,7 +431,7 @@ def test_run():
86baa9
 
86baa9
 
86baa9
 def test_run_no_capture_output():
86baa9
-    result = ipautil.run(['echo', 'foo\x02bar'])
86baa9
+    result = ipautil.run([paths.ECHO, 'foo\x02bar'])
86baa9
     assert result.returncode == 0
86baa9
     assert result.output is None
86baa9
     assert result.raw_output == b'foo\x02bar\n'
86baa9
@@ -439,13 +440,13 @@ def test_run_no_capture_output():
86baa9
 
86baa9
 
86baa9
 def test_run_bytes():
86baa9
-    result = ipautil.run(['echo', b'\x01\x02'], capture_output=True)
86baa9
+    result = ipautil.run([paths.ECHO, b'\x01\x02'], capture_output=True)
86baa9
     assert result.returncode == 0
86baa9
     assert result.raw_output == b'\x01\x02\n'
86baa9
 
86baa9
 
86baa9
 def test_run_decode():
86baa9
-    result = ipautil.run(['echo', u'รก'.encode('utf-8')],
86baa9
+    result = ipautil.run([paths.ECHO, u'รก'.encode('utf-8')],
86baa9
                          encoding='utf-8', capture_output=True)
86baa9
     assert result.returncode == 0
86baa9
     if six.PY3:
86baa9
@@ -457,11 +458,11 @@ def test_run_decode():
86baa9
 def test_run_decode_bad():
86baa9
     if six.PY3:
86baa9
         with pytest.raises(UnicodeDecodeError):
86baa9
-            ipautil.run(['echo', b'\xa0\xa1'],
86baa9
+            ipautil.run([paths.ECHO, b'\xa0\xa1'],
86baa9
                         capture_output=True,
86baa9
                         encoding='utf-8')
86baa9
     else:
86baa9
-        result = ipautil.run(['echo', '\xa0\xa1'],
86baa9
+        result = ipautil.run([paths.ECHO, '\xa0\xa1'],
86baa9
                              capture_output=True,
86baa9
                              encoding='utf-8')
86baa9
         assert result.returncode == 0
86baa9
@@ -469,7 +470,7 @@ def test_run_decode_bad():
86baa9
 
86baa9
 
86baa9
 def test_backcompat():
86baa9
-    result = out, err, rc = ipautil.run(['echo', 'foo\x02bar'],
86baa9
+    result = out, err, rc = ipautil.run([paths.ECHO, 'foo\x02bar'],
86baa9
                                         capture_output=True,
86baa9
                                         capture_error=True)
86baa9
     assert rc is result.returncode
86baa9
diff --git a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
86baa9
index 931f7aff344859ee62e8e195a5fa76a1b4807eb1..6ed6cbf34c62bb83b6ebaf84cc3b105d6f76aea6 100644
86baa9
--- a/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
86baa9
+++ b/ipatests/test_xmlrpc/test_caacl_profile_enforcement.py
86baa9
@@ -18,6 +18,7 @@ from cryptography.hazmat.primitives import hashes, serialization
86baa9
 from cryptography.hazmat.primitives.asymmetric import rsa
86baa9
 
86baa9
 from ipalib import api, errors
86baa9
+from ipaplatform.paths import paths
86baa9
 from ipatests.util import (
86baa9
     prepare_config, unlock_principal_password, change_principal,
86baa9
     host_keytab)
86baa9
@@ -50,7 +51,7 @@ def generate_user_csr(username, domain=None):
86baa9
         username=username)
86baa9
 
86baa9
     with tempfile.NamedTemporaryFile(mode='w') as csr_file:
86baa9
-        run(['openssl', 'req', '-new', '-key', CERT_RSA_PRIVATE_KEY_PATH,
86baa9
+        run([paths.OPENSSL, 'req', '-new', '-key', CERT_RSA_PRIVATE_KEY_PATH,
86baa9
              '-out', csr_file.name,
86baa9
              '-config', prepare_config(
86baa9
                  CERT_OPENSSL_CONFIG_TEMPLATE, csr_values)])
86baa9
diff --git a/ipatests/test_xmlrpc/test_cert_plugin.py b/ipatests/test_xmlrpc/test_cert_plugin.py
86baa9
index 9001e7f0989764a904275d11c5d96afc53322054..16f2058b1a9a38ec76479a184a23214275f5f551 100644
86baa9
--- a/ipatests/test_xmlrpc/test_cert_plugin.py
86baa9
+++ b/ipatests/test_xmlrpc/test_cert_plugin.py
86baa9
@@ -176,7 +176,7 @@ class test_cert(BaseCert):
86baa9
         result = api.Command.cert_show(sn, out=unicode(self.certfile))
86baa9
         with open(self.certfile, "rb") as f:
86baa9
             pem_cert = f.read().decode('ascii')
86baa9
-        result = run(['openssl', 'x509', '-text'],
86baa9
+        result = run([paths.OPENSSL, 'x509', '-text'],
86baa9
                      stdin=pem_cert, capture_output=True)
86baa9
         assert _EXP_CRL_URI in result.output
86baa9
         assert _EXP_OCSP_URI in result.output
86baa9
-- 
86baa9
2.20.1
86baa9