mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
more restrictive inventory env vars management
This commit is contained in:
parent
c19bb79587
commit
3566140ecc
@ -155,7 +155,7 @@ class AnsibleInventoryLoader(object):
|
||||
|
||||
if self.tmp_private_dir:
|
||||
shutil.rmtree(self.tmp_private_dir, True)
|
||||
if proc.returncode != 0 or 'file not found' in stderr:
|
||||
if proc.returncode != 0:
|
||||
raise RuntimeError('%s failed (rc=%d) with stdout:\n%s\nstderr:\n%s' % (
|
||||
self.method, proc.returncode, stdout, stderr))
|
||||
|
||||
|
@ -1235,6 +1235,14 @@ class InventorySourceOptions(BaseModel):
|
||||
)
|
||||
return None
|
||||
|
||||
def get_inventory_plugin_name(self):
|
||||
if self.source in CLOUD_PROVIDERS or self.source == 'custom':
|
||||
# TODO: today, all vendored sources are scripts
|
||||
# in future release inventory plugins will replace these
|
||||
return 'script'
|
||||
# in other cases we do not specify which plugin to use
|
||||
return None
|
||||
|
||||
def get_deprecated_credential(self, kind):
|
||||
for cred in self.credentials.all():
|
||||
if cred.credential_type.kind == kind:
|
||||
|
@ -1158,6 +1158,8 @@ class RunJob(BaseTask):
|
||||
if job.project:
|
||||
env['PROJECT_REVISION'] = job.project.scm_revision
|
||||
env['ANSIBLE_RETRY_FILES_ENABLED'] = "False"
|
||||
env['ANSIBLE_INVENTORY_ENABLED'] = 'script'
|
||||
env['ANSIBLE_INVENTORY_UNPARSED_FAILED'] = 'True'
|
||||
env['MAX_EVENT_RES'] = str(settings.MAX_EVENT_RES_DATA)
|
||||
if not kwargs.get('isolated'):
|
||||
env['ANSIBLE_CALLBACK_PLUGINS'] = plugin_path
|
||||
@ -1940,6 +1942,9 @@ class RunInventoryUpdate(BaseTask):
|
||||
env['INVENTORY_UPDATE_ID'] = str(inventory_update.pk)
|
||||
# Always use the --export option for ansible-inventory
|
||||
env['ANSIBLE_INVENTORY_EXPORT'] = str(True)
|
||||
plugin_name = inventory_update.get_inventory_plugin_name()
|
||||
if plugin_name is not None:
|
||||
env['ANSIBLE_INVENTORY_ENABLED'] = plugin_name
|
||||
|
||||
# Set environment variables specific to each source.
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user