From 8ba26d7d9afbbf05916c5c091660ac990056d991 Mon Sep 17 00:00:00 2001 From: Martin Jackson Date: Wed, 10 Jan 2024 17:48:03 -0600 Subject: [PATCH] Make use of shadow utils conditional on config --- mock/py/mockbuild/shadow_utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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): """