diff --git a/mock/py/mockbuild/shadow_utils.py b/mock/py/mockbuild/shadow_utils.py index 0cc1f36a7..4c28ccf5e 100644 --- a/mock/py/mockbuild/shadow_utils.py +++ b/mock/py/mockbuild/shadow_utils.py @@ -22,7 +22,11 @@ def _execute_command(self, command, can_fail=False): with self.root.uid_manager.elevated_privileges(): # Execute the command in bootstrap, since host configuration may not permit # ordinary user addition, such as would happen with freeipa-provided subids - do_with_status(command, chrootPath=self.chroot_dir, raiseExc=not can_fail) + if ('use_chroot_shadow_utils' in self.root.config) and self.root.config['use_chroot_shadow_utils']: + do_with_status(command, chrootPath=self.chroot_dir, raiseExc=not can_fail) + else: + do_with_status(command + ['--prefix', self.chroot_dir], raiseExc=not can_fail) + def delete_user(self, username, can_fail=False): """