Convert some leftover changeish mentions to ref
Noticed there were a few vestigal references to Changeish that didn't get converted, including the ChangeishFilter. Convert them to Ref. In model, there were two places where a method started with changeish = self.change. Those were removed and self.change was used in the method because ref = self.change led to the method having two important variables "ref" and "ret" which seems like a recipe for confusion. Of course, that led to one line being too long for pep8, so it was rewritten to use getattr instead of hasattr + and. Change-Id: I420b8ec7c7eb32574dfe2de467fc2bbd0f96e9f1
This commit is contained in:
parent
c6c3de6ba7
commit
55d0f56d61
|
@ -8,7 +8,7 @@ basic organizational structure that everything else hangs off.
|
||||||
|
|
||||||
Pipelines have a configured
|
Pipelines have a configured
|
||||||
:py:class:`~zuul.manager.PipelineManager` which controlls how
|
:py:class:`~zuul.manager.PipelineManager` which controlls how
|
||||||
the :py:class:`Change <zuul.model.Changeish>` objects are enqueued and
|
the :py:class:`Ref <zuul.model.Ref>` objects are enqueued and
|
||||||
processed.
|
processed.
|
||||||
|
|
||||||
There are currently two,
|
There are currently two,
|
||||||
|
@ -35,7 +35,7 @@ objects.
|
||||||
.. autoclass:: zuul.model.Build
|
.. autoclass:: zuul.model.Build
|
||||||
|
|
||||||
The :py:class:`~zuul.manager.base.PipelineManager` enqueues each
|
The :py:class:`~zuul.manager.base.PipelineManager` enqueues each
|
||||||
:py:class:`Change <zuul.model.Changeish>` into the
|
:py:class:`Ref <zuul.model.Ref>` into the
|
||||||
:py:class:`~zuul.model.ChangeQueue` in a :py:class:`~zuul.model.QueueItem`.
|
:py:class:`~zuul.model.ChangeQueue` in a :py:class:`~zuul.model.QueueItem`.
|
||||||
|
|
||||||
.. autoclass:: zuul.model.QueueItem
|
.. autoclass:: zuul.model.QueueItem
|
||||||
|
|
|
@ -773,12 +773,12 @@ class PipelineParser(object):
|
||||||
|
|
||||||
for source_name, require_config in conf.get('require', {}).items():
|
for source_name, require_config in conf.get('require', {}).items():
|
||||||
source = connections.getSource(source_name)
|
source = connections.getSource(source_name)
|
||||||
manager.changeish_filters.extend(
|
manager.ref_filters.extend(
|
||||||
source.getRequireFilters(require_config))
|
source.getRequireFilters(require_config))
|
||||||
|
|
||||||
for source_name, reject_config in conf.get('reject', {}).items():
|
for source_name, reject_config in conf.get('reject', {}).items():
|
||||||
source = connections.getSource(source_name)
|
source = connections.getSource(source_name)
|
||||||
manager.changeish_filters.extend(
|
manager.ref_filters.extend(
|
||||||
source.getRejectFilters(reject_config))
|
source.getRejectFilters(reject_config))
|
||||||
|
|
||||||
for trigger_name, trigger_config in conf.get('trigger').items():
|
for trigger_name, trigger_config in conf.get('trigger').items():
|
||||||
|
|
|
@ -47,7 +47,7 @@ class PipelineManager(object):
|
||||||
self.sched = sched
|
self.sched = sched
|
||||||
self.pipeline = pipeline
|
self.pipeline = pipeline
|
||||||
self.event_filters = []
|
self.event_filters = []
|
||||||
self.changeish_filters = []
|
self.ref_filters = []
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "<%s %s>" % (self.__class__.__name__, self.pipeline.name)
|
return "<%s %s>" % (self.__class__.__name__, self.pipeline.name)
|
||||||
|
@ -55,7 +55,7 @@ class PipelineManager(object):
|
||||||
def _postConfig(self, layout):
|
def _postConfig(self, layout):
|
||||||
self.log.info("Configured Pipeline Manager %s" % self.pipeline.name)
|
self.log.info("Configured Pipeline Manager %s" % self.pipeline.name)
|
||||||
self.log.info(" Requirements:")
|
self.log.info(" Requirements:")
|
||||||
for f in self.changeish_filters:
|
for f in self.ref_filters:
|
||||||
self.log.info(" %s" % f)
|
self.log.info(" %s" % f)
|
||||||
self.log.info(" Events:")
|
self.log.info(" Events:")
|
||||||
for e in self.event_filters:
|
for e in self.event_filters:
|
||||||
|
@ -281,7 +281,7 @@ class PipelineManager(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not ignore_requirements:
|
if not ignore_requirements:
|
||||||
for f in self.changeish_filters:
|
for f in self.ref_filters:
|
||||||
if f.connection_name != change.project.connection_name:
|
if f.connection_name != change.project.connection_name:
|
||||||
self.log.debug("Filter %s skipped for change %s due "
|
self.log.debug("Filter %s skipped for change %s due "
|
||||||
"to mismatched connections" % (f, change))
|
"to mismatched connections" % (f, change))
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ class QueueItem(object):
|
||||||
def __init__(self, queue, change):
|
def __init__(self, queue, change):
|
||||||
self.pipeline = queue.pipeline
|
self.pipeline = queue.pipeline
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.change = change # a changeish
|
self.change = change # a ref
|
||||||
self.build_sets = []
|
self.build_sets = []
|
||||||
self.dequeued_needing_change = False
|
self.dequeued_needing_change = False
|
||||||
self.current_build_set = BuildSet(self)
|
self.current_build_set = BuildSet(self)
|
||||||
|
@ -1589,15 +1589,14 @@ class QueueItem(object):
|
||||||
return (result, url)
|
return (result, url)
|
||||||
|
|
||||||
def formatJSON(self):
|
def formatJSON(self):
|
||||||
changeish = self.change
|
|
||||||
ret = {}
|
ret = {}
|
||||||
ret['active'] = self.active
|
ret['active'] = self.active
|
||||||
ret['live'] = self.live
|
ret['live'] = self.live
|
||||||
if hasattr(changeish, 'url') and changeish.url is not None:
|
if hasattr(self.change, 'url') and self.change.url is not None:
|
||||||
ret['url'] = changeish.url
|
ret['url'] = self.change.url
|
||||||
else:
|
else:
|
||||||
ret['url'] = None
|
ret['url'] = None
|
||||||
ret['id'] = changeish._id()
|
ret['id'] = self.change._id()
|
||||||
if self.item_ahead:
|
if self.item_ahead:
|
||||||
ret['item_ahead'] = self.item_ahead.change._id()
|
ret['item_ahead'] = self.item_ahead.change._id()
|
||||||
else:
|
else:
|
||||||
|
@ -1605,8 +1604,8 @@ class QueueItem(object):
|
||||||
ret['items_behind'] = [i.change._id() for i in self.items_behind]
|
ret['items_behind'] = [i.change._id() for i in self.items_behind]
|
||||||
ret['failing_reasons'] = self.current_build_set.failing_reasons
|
ret['failing_reasons'] = self.current_build_set.failing_reasons
|
||||||
ret['zuul_ref'] = self.current_build_set.ref
|
ret['zuul_ref'] = self.current_build_set.ref
|
||||||
if changeish.project:
|
if self.change.project:
|
||||||
ret['project'] = changeish.project.name
|
ret['project'] = self.change.project.name
|
||||||
else:
|
else:
|
||||||
# For cross-project dependencies with the depends-on
|
# For cross-project dependencies with the depends-on
|
||||||
# project not known to zuul, the project is None
|
# project not known to zuul, the project is None
|
||||||
|
@ -1614,8 +1613,8 @@ class QueueItem(object):
|
||||||
ret['project'] = "Unknown Project"
|
ret['project'] = "Unknown Project"
|
||||||
ret['enqueue_time'] = int(self.enqueue_time * 1000)
|
ret['enqueue_time'] = int(self.enqueue_time * 1000)
|
||||||
ret['jobs'] = []
|
ret['jobs'] = []
|
||||||
if hasattr(changeish, 'owner'):
|
if hasattr(self.change, 'owner'):
|
||||||
ret['owner'] = changeish.owner
|
ret['owner'] = self.change.owner
|
||||||
else:
|
else:
|
||||||
ret['owner'] = None
|
ret['owner'] = None
|
||||||
max_remaining = 0
|
max_remaining = 0
|
||||||
|
@ -1683,20 +1682,19 @@ class QueueItem(object):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def formatStatus(self, indent=0, html=False):
|
def formatStatus(self, indent=0, html=False):
|
||||||
changeish = self.change
|
|
||||||
indent_str = ' ' * indent
|
indent_str = ' ' * indent
|
||||||
ret = ''
|
ret = ''
|
||||||
if html and hasattr(changeish, 'url') and changeish.url is not None:
|
if html and getattr(self.change, 'url', None) is not None:
|
||||||
ret += '%sProject %s change <a href="%s">%s</a>\n' % (
|
ret += '%sProject %s change <a href="%s">%s</a>\n' % (
|
||||||
indent_str,
|
indent_str,
|
||||||
changeish.project.name,
|
self.change.project.name,
|
||||||
changeish.url,
|
self.change.url,
|
||||||
changeish._id())
|
self.change._id())
|
||||||
else:
|
else:
|
||||||
ret += '%sProject %s change %s based on %s\n' % (
|
ret += '%sProject %s change %s based on %s\n' % (
|
||||||
indent_str,
|
indent_str,
|
||||||
changeish.project.name,
|
self.change.project.name,
|
||||||
changeish._id(),
|
self.change._id(),
|
||||||
self.item_ahead)
|
self.item_ahead)
|
||||||
for job in self.getJobs():
|
for job in self.getJobs():
|
||||||
build = self.current_build_set.getBuild(job.name)
|
build = self.current_build_set.getBuild(job.name)
|
||||||
|
|
Loading…
Reference in New Issue