Include only fields that are present in the source object

This commit is contained in:
Pieter Noordhuis 2024-11-11 15:27:45 +01:00
parent 7545a1421a
commit 3f87b7fa06
No known key found for this signature in database
GPG Key ID: 12ACCCC104CF2930
1 changed files with 6 additions and 1 deletions

View File

@ -84,9 +84,14 @@ class Job:
permission["level"] = permission["permission_level"] permission["level"] = permission["permission_level"]
permission.pop("permission_level") permission.pop("permission_level")
# Filter out keys that are not in the base configuration
filtered_ordered_keys = [k for k in ordered_keys if k in obj]
return { return {
"resources": { "resources": {
"jobs": {self.normalized_key(): {k: obj[k] for k in ordered_keys}} "jobs": {
self.normalized_key(): {k: obj[k] for k in filtered_ordered_keys}
}
} }
} }