mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 05:55:59 -03:30
remove old callback plugin code and tests
This commit is contained in:
@@ -191,18 +191,7 @@ def run_isolated_job(private_data_dir, secrets, logfile=sys.stdout):
|
||||
job_timeout = secrets.get('job_timeout', 10)
|
||||
pexpect_timeout = secrets.get('pexpect_timeout', 5)
|
||||
|
||||
# Use local callback directory
|
||||
callback_dir = os.getenv('AWX_LIB_DIRECTORY')
|
||||
if callback_dir is None:
|
||||
raise RuntimeError('Location for callbacks must be specified '
|
||||
'by environment variable AWX_LIB_DIRECTORY.')
|
||||
env['ANSIBLE_CALLBACK_PLUGINS'] = os.path.join(callback_dir, 'isolated_callbacks')
|
||||
if 'AD_HOC_COMMAND_ID' in env:
|
||||
env['ANSIBLE_STDOUT_CALLBACK'] = 'minimal'
|
||||
else:
|
||||
env['ANSIBLE_STDOUT_CALLBACK'] = 'awx_display'
|
||||
env['AWX_ISOLATED_DATA_DIR'] = private_data_dir
|
||||
env['PYTHONPATH'] = env.get('PYTHONPATH', '') + callback_dir + ':'
|
||||
|
||||
venv_path = env.get('VIRTUAL_ENV')
|
||||
if venv_path and not os.path.exists(venv_path):
|
||||
|
||||
@@ -1354,7 +1354,6 @@ class RunJob(BaseTask):
|
||||
env['MAX_EVENT_RES'] = str(settings.MAX_EVENT_RES_DATA)
|
||||
if not isolated:
|
||||
env['ANSIBLE_CALLBACK_PLUGINS'] = plugin_path
|
||||
env['ANSIBLE_STDOUT_CALLBACK'] = 'awx_display'
|
||||
env['AWX_HOST'] = settings.TOWER_URL_BASE
|
||||
|
||||
# Create a directory for ControlPath sockets that is unique to each
|
||||
@@ -1632,7 +1631,6 @@ class RunProjectUpdate(BaseTask):
|
||||
env['TMP'] = settings.AWX_PROOT_BASE_PATH
|
||||
env['PROJECT_UPDATE_ID'] = str(project_update.pk)
|
||||
env['ANSIBLE_CALLBACK_PLUGINS'] = self.get_path_to('..', 'plugins', 'callback')
|
||||
env['ANSIBLE_STDOUT_CALLBACK'] = 'awx_display'
|
||||
return env
|
||||
|
||||
def _build_scm_url_extra_vars(self, project_update, scm_username='', scm_password=''):
|
||||
@@ -2383,7 +2381,6 @@ class RunAdHocCommand(BaseTask):
|
||||
env['INVENTORY_HOSTVARS'] = str(True)
|
||||
env['ANSIBLE_CALLBACK_PLUGINS'] = plugin_dir
|
||||
env['ANSIBLE_LOAD_CALLBACK_PLUGINS'] = '1'
|
||||
env['ANSIBLE_STDOUT_CALLBACK'] = 'minimal' # Hardcoded by Ansible for ad-hoc commands (either minimal or oneline).
|
||||
env['ANSIBLE_SFTP_BATCH_MODE'] = 'False'
|
||||
|
||||
# Specify empty SSH args (should disable ControlPersist entirely for
|
||||
|
||||
@@ -189,16 +189,11 @@ def test_run_isolated_job(private_data_dir, rsa_key):
|
||||
mgr.build_isolated_job_data()
|
||||
stdout = StringIO()
|
||||
# Mock environment variables for callback module
|
||||
with mock.patch('os.getenv') as env_mock:
|
||||
env_mock.return_value = '/path/to/awx/lib'
|
||||
status, rc = run.run_isolated_job(private_data_dir, secrets, stdout)
|
||||
status, rc = run.run_isolated_job(private_data_dir, secrets, stdout)
|
||||
assert status == 'successful'
|
||||
assert rc == 0
|
||||
assert FILENAME in stdout.getvalue()
|
||||
|
||||
assert '/path/to/awx/lib' in env['PYTHONPATH']
|
||||
assert env['ANSIBLE_STDOUT_CALLBACK'] == 'awx_display'
|
||||
assert env['ANSIBLE_CALLBACK_PLUGINS'] == '/path/to/awx/lib/isolated_callbacks'
|
||||
assert env['AWX_ISOLATED_DATA_DIR'] == private_data_dir
|
||||
|
||||
|
||||
@@ -230,9 +225,6 @@ def test_run_isolated_adhoc_command(private_data_dir, rsa_key):
|
||||
# an ad-hoc command that runs `pwd` should print `private_data_dir` to stdout
|
||||
assert private_data_dir in stdout.getvalue()
|
||||
|
||||
assert '/path/to/awx/lib' in env['PYTHONPATH']
|
||||
assert env['ANSIBLE_STDOUT_CALLBACK'] == 'minimal'
|
||||
assert env['ANSIBLE_CALLBACK_PLUGINS'] == '/path/to/awx/lib/isolated_callbacks'
|
||||
assert env['AWX_ISOLATED_DATA_DIR'] == private_data_dir
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user