Add awareness of upgrade exit code, success/fail
This commit is contained in:
parent
7a14b42345
commit
77880abb87
|
@ -83,6 +83,7 @@ class UpgradeView(MasterView):
|
||||||
'status_code',
|
'status_code',
|
||||||
'stdout_file',
|
'stdout_file',
|
||||||
'stderr_file',
|
'stderr_file',
|
||||||
|
'exit_code',
|
||||||
'package_diff',
|
'package_diff',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -116,6 +117,12 @@ class UpgradeView(MasterView):
|
||||||
# g.set_link('not_until')
|
# g.set_link('not_until')
|
||||||
g.set_link('executed')
|
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):
|
def configure_form(self, f):
|
||||||
super(UpgradeView, self).configure_form(f)
|
super(UpgradeView, self).configure_form(f)
|
||||||
f.set_enum('status_code', self.enum.UPGRADE_STATUS)
|
f.set_enum('status_code', self.enum.UPGRADE_STATUS)
|
||||||
|
@ -156,6 +163,7 @@ class UpgradeView(MasterView):
|
||||||
|
|
||||||
if not self.viewing or not upgrade.executed:
|
if not self.viewing or not upgrade.executed:
|
||||||
f.remove_field('package_diff')
|
f.remove_field('package_diff')
|
||||||
|
f.remove_field('exit_code')
|
||||||
|
|
||||||
def render_stdout_file(self, upgrade, fieldname):
|
def render_stdout_file(self, upgrade, fieldname):
|
||||||
if fieldname.startswith('stderr'):
|
if fieldname.startswith('stderr'):
|
||||||
|
@ -246,9 +254,12 @@ class UpgradeView(MasterView):
|
||||||
upgrade.executing = True
|
upgrade.executing = True
|
||||||
upgrade.status_code = self.enum.UPGRADE_STATUS_EXECUTING
|
upgrade.status_code = self.enum.UPGRADE_STATUS_EXECUTING
|
||||||
session.commit()
|
session.commit()
|
||||||
self.handler.execute(upgrade, user, **kwargs)
|
result = self.handler.execute(upgrade, user, **kwargs)
|
||||||
upgrade.executing = False
|
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 = make_utc()
|
||||||
upgrade.executed_by = user
|
upgrade.executed_by = user
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue