Handle job or build is None in formatUrlPattern
Either job or build may be None in formatUrlPattern, in which case
calling getSafeAttributes for those objects will raise an Exception.
In these cases, set safe_job and/or safe_build to {}.
Change-Id: Ifd63acc462ae159a046821c11c02407836ec01c9
diff --git a/zuul/model.py b/zuul/model.py
index 30bcb9b..b68abef 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -1524,8 +1524,8 @@
# secrets, etc.
safe_change = self.change.getSafeAttributes()
safe_pipeline = self.pipeline.getSafeAttributes()
- safe_job = job.getSafeAttributes()
- safe_build = build.getSafeAttributes()
+ safe_job = job.getSafeAttributes() if job else {}
+ safe_build = build.getSafeAttributes() if build else {}
try:
url = url_pattern.format(change=safe_change,
pipeline=safe_pipeline,