Skip to content
This repository has been archived by the owner on Aug 21, 2018. It is now read-only.

Commit

Permalink
Log error instead of failing when release not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
xebialabs-se committed Oct 12, 2017
1 parent f0e7e64 commit bef755e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/jython/relationships/fetch_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,24 @@ def process_tasks(tasks, graph, node):
def analyse(release_id, graph):
if not graph.node_processed(release_id):
release = read(release_id)
kind = "template" if str(release.status) == "TEMPLATE" else "release"
node = graph.add_node(release.title, release_id, kind, release.status)
[process_tasks(p.tasks, graph, node) for p in release.phases]
if release is not None:
kind = "template" if str(release.status) == "TEMPLATE" else "release"
node = graph.add_node(release.title, release_id, kind, release.status)
[process_tasks(p.tasks, graph, node) for p in release.phases]


def read(release_id):
try:
return templateApi.getTemplate(release_id)
except NotFoundException:
return releaseApi.getArchivedRelease(release_id)
try:
return releaseApi.getArchivedRelease(release_id)
except NotFoundException:
msg = "Release id [%s] not found. " % release_id
msg += "Could be caused by the importing a template that has a reference to a non-existing template. "
msg += "Another cause could could be the removal of archived releases."
logger.error(msg)
return None


rid = request.query["id"]
Expand Down

0 comments on commit bef755e

Please sign in to comment.