diff --git a/tailbone/views/upgrades.py b/tailbone/views/upgrades.py index 2589379d..1dacb2f1 100644 --- a/tailbone/views/upgrades.py +++ b/tailbone/views/upgrades.py @@ -83,6 +83,7 @@ class UpgradeView(MasterView): 'status_code', 'stdout_file', 'stderr_file', + 'exit_code', 'package_diff', ] @@ -116,6 +117,12 @@ class UpgradeView(MasterView): # g.set_link('not_until') g.set_link('executed') + def grid_extra_class(self, upgrade, i): + if upgrade.status_code == self.enum.UPGRADE_STATUS_FAILED: + return 'warning' + if upgrade.status_code == self.enum.UPGRADE_STATUS_EXECUTING: + return 'notice' + def configure_form(self, f): super(UpgradeView, self).configure_form(f) f.set_enum('status_code', self.enum.UPGRADE_STATUS) @@ -156,6 +163,7 @@ class UpgradeView(MasterView): if not self.viewing or not upgrade.executed: f.remove_field('package_diff') + f.remove_field('exit_code') def render_stdout_file(self, upgrade, fieldname): if fieldname.startswith('stderr'): @@ -246,9 +254,12 @@ class UpgradeView(MasterView): upgrade.executing = True upgrade.status_code = self.enum.UPGRADE_STATUS_EXECUTING session.commit() - self.handler.execute(upgrade, user, **kwargs) + result = self.handler.execute(upgrade, user, **kwargs) upgrade.executing = False - upgrade.status_code = self.enum.UPGRADE_STATUS_SUCCEEDED + if result: + upgrade.status_code = self.enum.UPGRADE_STATUS_SUCCEEDED + else: + upgrade.status_code = self.enum.UPGRADE_STATUS_FAILED upgrade.executed = make_utc() upgrade.executed_by = user