Merge "Implement getSafeAttributes for other objects" into feature/zuulv3
diff --git a/zuul/model.py b/zuul/model.py
index cdbd718..6f40a45 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -164,6 +164,9 @@
def __repr__(self):
return '<Pipeline %s>' % self.name
+ def getSafeAttributes(self):
+ return Attributes(name=self.name)
+
def setManager(self, manager):
self.manager = manager
@@ -825,6 +828,9 @@
def _get(self, name):
return self.__dict__.get(name)
+ def getSafeAttributes(self):
+ return Attributes(name=self.name)
+
def setRun(self):
if not self.run:
self.run = self.implied_run
@@ -1054,6 +1060,9 @@
return ('<Build %s of %s on %s>' %
(self.uuid, self.job.name, self.worker))
+ def getSafeAttributes(self):
+ return Attributes(uuid=self.uuid)
+
class Worker(object):
"""Information about the specific worker executing a Build."""
@@ -1514,9 +1523,9 @@
# the entire data structure where they might be able to access
# secrets, etc.
safe_change = self.change.getSafeAttributes()
- safe_pipeline = Attributes(name=self.pipeline.name)
- safe_job = Attributes(name=job.name)
- safe_build = Attributes(uuid=build.uuid)
+ safe_pipeline = self.pipeline.getSafeAttributes()
+ safe_job = job.getSafeAttributes()
+ safe_build = build.getSafeAttributes()
if pattern:
try:
url = pattern.format(change=safe_change,