Skip to content
This repository was archived by the owner on Oct 27, 2025. It is now read-only.

Commit 6074135

Browse files
committed
Update required on dci-diff-jobs script
This change is to update diff-jobs.py script since "where" query used inside this script doesn't support the non-existence field "url".Hence, updated script with new way to query by replacing "where" with "query", which now allow non-existence field "url" also. TestDallasWorkload: control-plane-example Change-Id: I34d07aa08ca565a3266c7875f583d3f46e56e3aa
1 parent ae98dda commit 6074135

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

dciclient/diff_jobs.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ def get_component_info(comp):
3636
return (comp["type"], comp["name"])
3737

3838

39-
def build_where_clause(job_info):
40-
where = []
39+
def build_query_clause(job_info):
40+
query = []
4141
for key in ("name", "remoteci_id", "topic_id", "configuration", "url"):
4242
if job_info[key]:
43-
where.append("%s:%s" % (key, job_info[key]))
43+
query.append("eq" + "(%s,%s)" % (key, job_info[key]))
4444
else:
45-
where.append("%s:" % key)
46-
return ",".join(where)
45+
query.append("null" + "(%s)" % key)
46+
return ",".join(query)
4747

4848

4949
def get_jobs(context, args):
5050
if args.job_id_1 is None:
5151
sys.stderr.write("No job_id_1 provided, getting latest job: ")
5252
sys.stderr.flush()
5353
jobs = dci_job.list(context,
54-
where="status:success",
54+
query="eq(status:success)",
5555
limit=1,
5656
offset=0).json()["jobs"]
5757
job_1 = jobs[0]
@@ -61,13 +61,13 @@ def get_jobs(context, args):
6161
job_1 = dci_job.get(context, args.job_id_1).json()["job"]
6262

6363
if args.job_id_2 is None:
64-
where = build_where_clause(job_1)
65-
sys.stderr.write("No job_id_2 provided, getting another job using %s: " % where)
64+
query = build_query_clause(job_1)
65+
sys.stderr.write("No job_id_2 provided, getting another job using %s: " % query)
6666
sys.stderr.flush()
6767
jobs = dci_job.list(context,
6868
limit=2,
6969
offset=0,
70-
where=where,
70+
query=query,
7171
sort="-created_at").json()["jobs"]
7272
if len(jobs) != 2:
7373
raise DiffJobsError("no other job")

0 commit comments

Comments
 (0)