Fixing problem with validation of job binaries update

Job binary can't be updated without url changing

Change-Id: Ibe41cde236837af34c422e2dea7979a260997759
Closes-bug: #1508507
This commit is contained in:
Andrey Pavlov 2015-10-21 18:29:02 +03:00
parent 83966a043b
commit b0b5556a46

View File

@ -23,12 +23,18 @@ CONF = cfg.CONF
def check_job_binary(data, **kwargs):
job_binary_location_type = data["url"]
job_binary_url = data.get("url", None)
extra = data.get("extra", {})
if job_binary_location_type.startswith(su.SWIFT_INTERNAL_PREFIX):
if (not extra.get("user") or not extra.get("password")) and (
not CONF.use_domain_for_proxy_users):
raise e.BadJobBinaryException()
if job_binary_location_type.startswith("internal-db"):
internal_uid = job_binary_location_type[len("internal-db://"):]
b.check_job_binary_internal_exists(internal_uid)
if job_binary_url:
if job_binary_url.startswith("internal-db"):
internal_uid = job_binary_url.replace(
"internal-db://", '')
b.check_job_binary_internal_exists(internal_uid)
if job_binary_url.startswith(su.SWIFT_INTERNAL_PREFIX):
if not kwargs.get('job_binary_id', None):
# Should not be checked during job binary update
if (not extra.get("user") or not extra.get("password")) and (
not CONF.use_domain_for_proxy_users):
raise e.BadJobBinaryException()