mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
Merge pull request #473 from AlanCoding/test_fix_exc
fix test fallout from 321 merge
This commit is contained in:
commit
6347db56c5
@ -678,19 +678,11 @@ class BaseTask(LogErrorsTask):
|
||||
|
||||
def build_inventory(self, instance, **kwargs):
|
||||
path = os.path.join(kwargs['private_data_dir'], 'inventory')
|
||||
if not os.path.exists(path):
|
||||
with open(path, 'w') as f:
|
||||
json_data = json.dumps(instance.inventory.get_script_data(hostvars=True))
|
||||
f.write('#! /usr/bin/env python\n# -*- coding: utf-8 -*-\nprint """%s"""\n' % json_data)
|
||||
os.chmod(path, stat.S_IRUSR | stat.S_IXUSR)
|
||||
return path
|
||||
else:
|
||||
# work around an inventory caching bug in Ansible 2.4.0
|
||||
# see: https://github.com/ansible/ansible/pull/30817
|
||||
# see: https://github.com/ansible/awx/issues/246
|
||||
inventory_script = tempfile.mktemp(suffix='.awxrest.py', dir=kwargs['private_data_dir'])
|
||||
shutil.copy(plugin, inventory_script)
|
||||
return inventory_script
|
||||
with open(path, 'w') as f:
|
||||
json_data = json.dumps(instance.inventory.get_script_data(hostvars=True))
|
||||
f.write('#! /usr/bin/env python\n# -*- coding: utf-8 -*-\nprint """%s"""\n' % json_data)
|
||||
os.chmod(path, stat.S_IRUSR | stat.S_IXUSR)
|
||||
return path
|
||||
|
||||
def build_args(self, instance, **kwargs):
|
||||
raise NotImplementedError
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
import tempfile
|
||||
import pytest
|
||||
import json
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@ -268,7 +268,7 @@ class TestGenericRun(TestJobExecution):
|
||||
self.task.run(self.pk)
|
||||
for c in [
|
||||
mock.call(self.pk, execution_node=settings.CLUSTER_HOST_ID, status='running'),
|
||||
mock.call(self.pk, output_replacements=[], result_traceback=mock.ANY, status='canceled')
|
||||
mock.call(self.pk, status='canceled')
|
||||
]:
|
||||
assert c in self.task.update_model.call_args_list
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user