mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
run scm inv syncs at the project root so relative imports work w/ bwrap
see: https://github.com/ansible/tower/issues/1357
This commit is contained in:
parent
fd0b439ee6
commit
3ab7f06f95
@ -135,8 +135,7 @@ class AnsibleInventoryLoader(object):
|
||||
self.tmp_private_dir = build_proot_temp_dir()
|
||||
logger.debug("Using fresh temporary directory '{}' for isolation.".format(self.tmp_private_dir))
|
||||
kwargs['proot_temp_dir'] = self.tmp_private_dir
|
||||
# Run from source's location so that custom script contents are in `show_paths`
|
||||
cwd = functioning_dir(self.source)
|
||||
kwargs['proot_show_paths'] = [functioning_dir(self.source)]
|
||||
logger.debug("Running from `{}` working directory.".format(cwd))
|
||||
|
||||
return wrap_args_with_proot(cmd, cwd, **kwargs)
|
||||
|
@ -1720,6 +1720,10 @@ class RunInventoryUpdate(BaseTask):
|
||||
event_model = InventoryUpdateEvent
|
||||
event_data_key = 'inventory_update_id'
|
||||
|
||||
@property
|
||||
def proot_show_paths(self):
|
||||
return [self.get_path_to('..', 'plugins', 'inventory')]
|
||||
|
||||
def build_private_data(self, inventory_update, **kwargs):
|
||||
"""
|
||||
Return private data needed for inventory update.
|
||||
@ -2075,6 +2079,8 @@ class RunInventoryUpdate(BaseTask):
|
||||
return args
|
||||
|
||||
def build_cwd(self, inventory_update, **kwargs):
|
||||
if inventory_update.source == 'scm' and inventory_update.source_project_update:
|
||||
return inventory_update.source_project_update.get_project_path(check_if_exists=False)
|
||||
return self.get_path_to('..', 'plugins', 'inventory')
|
||||
|
||||
def get_idle_timeout(self):
|
||||
|
Loading…
Reference in New Issue
Block a user