summaryrefslogtreecommitdiff
path: root/zuul/executor
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2021-11-12 15:43:24 -0800
committerJames E. Blair <jim@acmegating.com>2021-11-12 15:50:02 -0800
commitb7e2e49f7fc4d0d4807c573d23c311971eb5afde (patch)
treeb731cc8a94040cc4c647f1423905cd69cf912369 /zuul/executor
parentf97a6f627e13b133febb565d4a5e9d10d42fe606 (diff)
downloadzuul-b7e2e49f7fc4d0d4807c573d23c311971eb5afde.tar.gz
Use sort_keys with json almost everywhere we write to ZK
For almost any data we write to ZK (except for long-standing nodepool classes), add the sort_keys=True so that we can more easily determine whether an update is required. This is in service of zkobject, and is not strictly necessary because the json module follows dict insertion order, and our serialize methods are obviously internally consistent (at least, if they're going to produce the same data, which is all we care about). But that hasn't always been true and might not be true in the future, so this is good future-proofing. Based on a similar thought, the argument is also added to several places which do not use zkobject but which do write to ZK, in case we perform a similar check in the future. This seems like a good habit to use throughout the code base. Change-Id: Idca67942c057ab0e6b629b50b9b3367ccc0e4ad7
Diffstat (limited to 'zuul/executor')
-rw-r--r--zuul/executor/server.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index fc7760472..204bbad03 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -1226,7 +1226,8 @@ class AnsibleJob(object):
result=None,
error_detail=f'Failed to update project '
f'{task.project_name}')
- self.job.sendWorkComplete(json.dumps(result))
+ self.job.sendWorkComplete(
+ json.dumps(result, sort_keys=True))
return
raise ExecutorError(