Tweak tempmon views a little, fix client restart logic

This commit is contained in:
Lance Edgar 2016-12-07 16:00:00 -06:00
parent aedbe5214f
commit d8c4f92aa5
3 changed files with 8 additions and 1 deletions

View file

@ -64,6 +64,7 @@ class TempmonClientView(MasterView):
Master view for tempmon clients. Master view for tempmon clients.
""" """
model_class = tempmon.Client model_class = tempmon.Client
model_title = "TempMon Client"
route_prefix = 'tempmon.clients' route_prefix = 'tempmon.clients'
url_prefix = '/tempmon/clients' url_prefix = '/tempmon/clients'
@ -107,7 +108,7 @@ class TempmonClientView(MasterView):
def restart(self): def restart(self):
client = self.get_instance() client = self.get_instance()
try: try:
subprocess.check_output(['ssh', client.hostname, 'sudo service tempmon restart'], subprocess.check_output(['ssh', client.hostname, 'sudo service tempmon-client restart'],
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as error: except subprocess.CalledProcessError as error:
self.request.session.flash("Failed to restart client: {}".format(error.output), 'error') self.request.session.flash("Failed to restart client: {}".format(error.output), 'error')

View file

@ -37,6 +37,7 @@ class TempmonProbeView(MasterView):
Master view for tempmon probes. Master view for tempmon probes.
""" """
model_class = tempmon.Probe model_class = tempmon.Probe
model_title = "TempMon Probe"
route_prefix = 'tempmon.probes' route_prefix = 'tempmon.probes'
url_prefix = '/tempmon/probes' url_prefix = '/tempmon/probes'

View file

@ -36,11 +36,16 @@ class TempmonReadingView(MasterView):
Master view for tempmon readings. Master view for tempmon readings.
""" """
model_class = tempmon.Reading model_class = tempmon.Reading
model_title = "TempMon Reading"
route_prefix = 'tempmon.readings' route_prefix = 'tempmon.readings'
url_prefix = '/tempmon/readings' url_prefix = '/tempmon/readings'
creatable = False creatable = False
editable = False editable = False
def _preconfigure_grid(self, g):
g.default_sortkey = 'taken'
g.default_sortdir = 'desc'
def configure_grid(self, g): def configure_grid(self, g):
g.configure( g.configure(
include=[ include=[