mirror of
https://github.com/ansible/awx.git
synced 2026-02-21 13:10:11 -03:30
encrypt job survey data
see: https://github.com/ansible/ansible-tower/issues/7046
This commit is contained in:
committed by
Matthew Jones
parent
9978b3f9ad
commit
4be4e3db7f
@@ -31,7 +31,7 @@ from awx.main.models import (
|
||||
)
|
||||
|
||||
from awx.main import tasks
|
||||
from awx.main.utils import encrypt_field
|
||||
from awx.main.utils import encrypt_field, encrypt_value
|
||||
|
||||
|
||||
|
||||
@@ -306,6 +306,20 @@ class TestGenericRun(TestJobExecution):
|
||||
assert '"awx_user_id": 123,' in ' '.join(args)
|
||||
assert '"awx_user_name": "angry-spud"' in ' '.join(args)
|
||||
|
||||
def test_survey_extra_vars(self):
|
||||
self.instance.extra_vars = json.dumps({
|
||||
'super_secret': encrypt_value('CLASSIFIED', pk=None)
|
||||
})
|
||||
self.instance.survey_passwords = {
|
||||
'super_secret': '$encrypted$'
|
||||
}
|
||||
self.task.run(self.pk)
|
||||
|
||||
assert self.run_pexpect.call_count == 1
|
||||
call_args, _ = self.run_pexpect.call_args_list[0]
|
||||
args, cwd, env, stdout = call_args
|
||||
assert '"super_secret": "CLASSIFIED"' in ' '.join(args)
|
||||
|
||||
def test_awx_task_env(self):
|
||||
patch = mock.patch('awx.main.tasks.settings.AWX_TASK_ENV', {'FOO': 'BAR'})
|
||||
patch.start()
|
||||
|
||||
Reference in New Issue
Block a user