This is an automated email from the git hooks/post-receive script.
praiskup pushed a commit to branch master
in repository copr/copr.
The following commit(s) were added to refs/heads/master by this push:
new 5cec3fe fronted: builder-live.log path leads to an exception
5cec3fe is described below
commit 5cec3fe0bfd8da4813cc98a2e4254dcff3d5556b
Author: Silvie Chlupova <sisi.chlupova(a)gmail.com>
AuthorDate: Thu Sep 26 13:19:52 2019 +0200
fronted: builder-live.log path leads to an exception
Merges: #1030
---
frontend/coprs_frontend/coprs/models.py | 19 +++++++++++--------
.../coprs/templates/coprs/detail/build.html | 4 ++--
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/models.py
b/frontend/coprs_frontend/coprs/models.py
index c68a61e..b616ed0 100644
--- a/frontend/coprs_frontend/coprs/models.py
+++ b/frontend/coprs_frontend/coprs/models.py
@@ -935,14 +935,6 @@ class Build(db.Model, helpers.Serializer):
path = os.path.normpath(os.path.join(*parts))
return urljoin(app.config["BACKEND_BASE_URL"], path)
- def backend_live_log(self, chroot):
- parts = ["results", self.copr.owner_name, self.copr_dirname,
- chroot.name, self.id_fixed_width + "-" + self.package.name,
- "builder-live.log" if chroot.status ==
StatusEnum("running")
- else "builder-live.log.gz"]
- path = os.path.normpath(os.path.join(*parts))
- return urljoin(app.config["BACKEND_BASE_URL"], path)
-
@property
def source_json_dict(self):
if not self.source_json:
@@ -1403,6 +1395,17 @@ class BuildChroot(db.Model, helpers.Serializer):
return urljoin(app.config["BACKEND_BASE_URL"], os.path.join(
"results", self.build.copr_dir.full_name, self.name,
self.result_dir, ""))
+ @property
+ def live_log_link(self):
+ if not self.build.package:
+ return None
+
+ if not (self.finished or self.state == "running"):
+ return None
+
+ return os.path.join(self.result_dir_url,
+ "builder-live.log" if self.state ==
'running' else "builder-live.log.gz")
+
class LegalFlag(db.Model, helpers.Serializer):
id = db.Column(db.Integer, primary_key=True)
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/build.html
b/frontend/coprs_frontend/coprs/templates/coprs/detail/build.html
index 9cfc41d..a55b313 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/detail/build.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/build.html
@@ -228,8 +228,8 @@
{{ chroot.started_on|time_ago(chroot.ended_on) }}
</td>
<td>
- {% if chroot.finished or chroot.state == "running" %}
- <a href="{{ build.backend_live_log(chroot) }}">{{
build_state_text(chroot.state) }}</a>
+ {% if chroot.live_log_link %}
+ <a href="{{ chroot.live_log_link }}">{{
build_state_text(chroot.state) }}</a>
{% else %}
{{ build_state_text(chroot.state) }}
{% endif %}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date