mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 06:51:10 +03:00
Reenable test for key=value extra vars, remove some unused imports.
This commit is contained in:
parent
680e382a40
commit
12f07e454f
@ -14,9 +14,6 @@ import uuid
|
||||
import copy
|
||||
import random
|
||||
|
||||
# PyYAML
|
||||
import yaml
|
||||
|
||||
# Django
|
||||
from django.conf import settings
|
||||
from django.db import models, connection
|
||||
|
@ -12,9 +12,6 @@ import re
|
||||
import shlex
|
||||
import uuid
|
||||
|
||||
# PyYAML
|
||||
import yaml
|
||||
|
||||
# Django
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
@ -456,18 +453,7 @@ class Job(UnifiedJob, JobOptions):
|
||||
extra_vars = json.loads(extra_data)
|
||||
except Exception, e:
|
||||
logger.warn("Exception deserializing extra vars: " + str(e))
|
||||
if self.extra_vars is None or self.extra_vars == "":
|
||||
evars = {}
|
||||
elif type(self.extra_vars) == dict:
|
||||
evars = self.extra_vars
|
||||
else:
|
||||
try:
|
||||
evars = json.loads(self.extra_vars)
|
||||
except ValueError:
|
||||
try:
|
||||
evars = yaml.safe_load(self.extra_vars)
|
||||
except yaml.YAMLError:
|
||||
evars = {}
|
||||
evars = self.extra_vars_dict
|
||||
evars.update(extra_vars)
|
||||
self.update_fields(extra_vars=json.dumps(evars))
|
||||
|
||||
|
@ -13,9 +13,6 @@ import shlex
|
||||
import urlparse
|
||||
import uuid
|
||||
|
||||
# PyYAML
|
||||
import yaml
|
||||
|
||||
# Django
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
@ -11,9 +11,6 @@ import os
|
||||
import os.path
|
||||
from StringIO import StringIO
|
||||
|
||||
# PyYAML
|
||||
import yaml
|
||||
|
||||
# Django
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
|
@ -887,14 +887,14 @@ class RunJobTest(BaseCeleryTest):
|
||||
self.assertTrue('"--forks=3"' in job.job_args)
|
||||
self.assertTrue('"-vv"' in job.job_args)
|
||||
self.assertTrue('"-e"' in job.job_args)
|
||||
# Test with extra_vars as key=value (old format).
|
||||
# TODO: Do we still support this?
|
||||
# job_template2 = self.create_test_job_template(extra_vars='foo=1')
|
||||
# job2 = self.create_test_job(job_template=job_template2)
|
||||
# self.assertEqual(job2.status, 'new')
|
||||
# self.assertTrue(job2.signal_start())
|
||||
# job2 = Job.objects.get(pk=job2.pk)
|
||||
# self.check_job_result(job2, 'successful')
|
||||
# Test with extra_vars as key=value (old format, still supported by
|
||||
# -e option to ansible-playbook).
|
||||
job_template2 = self.create_test_job_template(extra_vars='foo=1')
|
||||
job2 = self.create_test_job(job_template=job_template2)
|
||||
self.assertEqual(job2.status, 'new')
|
||||
self.assertTrue(job2.signal_start())
|
||||
job2 = Job.objects.get(pk=job2.pk)
|
||||
self.check_job_result(job2, 'successful')
|
||||
# Test with extra_vars as YAML (should be converted to JSON in args).
|
||||
job_template3 = self.create_test_job_template(extra_vars='abc: 1234')
|
||||
job3 = self.create_test_job(job_template=job_template3)
|
||||
|
Loading…
Reference in New Issue
Block a user