updates to service monitor. fix 500 on /api/info for empty listings

This commit is contained in:
KeyserSosa
2009-01-26 15:33:13 -08:00
parent 4440ccfc6e
commit 16fc8d5818
3 changed files with 2 additions and 11 deletions

View File

@@ -302,7 +302,7 @@ class RedditJsonTemplate(JsonTemplate):
class PanestackJsonTemplate(JsonTemplate):
def render(self, thing = None, *a, **kw):
res = [t.render() for t in thing.stack] if thing else []
res = [t.render() for t in thing.stack if t] if thing else []
res = [x for x in res if x]
if not res:
return {}

View File

@@ -21,5 +21,5 @@
################################################################################
%for t in thing.stack:
${t.render()}
${t.render() if t else ''}
%endfor

View File

@@ -298,15 +298,6 @@ def run_top(proc_ids = [], name = '', exe = "/usr/bin/top"):
handle = subprocess.Popen(cmd, stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
if handle.wait():
cmd = [exe, '-l', '1', '-p',
"^aaaaa ^nnnnnnnnn X X X X X X ^ccccc 0.0" +
" ^wwwwwwwwwww ^bbbbbbbbbbbbbbb"]
handle = subprocess.Popen(cmd, stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
if handle.wait():
raise ValueError, "failed to run top"
proc_ids = set(map(int, proc_ids))
res = {}
for line in handle.communicate()[0].split('\n'):