diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2007-08-15 16:31:31 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2007-08-15 16:31:31 -0400 |
commit | 5e1781852fb81a3263692eda3b4977c8fb761c1a (patch) | |
tree | b21cbb7fbfc4f0fcc2f5c37f1dc8da10cec85068 /cobbler/action_status.py | |
parent | cda9754a7ab3172ca45d083d7ee9d3bc7aa2c88e (diff) | |
download | third_party-cobbler-5e1781852fb81a3263692eda3b4977c8fb761c1a.tar.gz third_party-cobbler-5e1781852fb81a3263692eda3b4977c8fb761c1a.tar.xz third_party-cobbler-5e1781852fb81a3263692eda3b4977c8fb761c1a.zip |
Ben Riggs patch to allow find to take arbitrary variables plus a reworking
of find (mpd) to add some error checking, list returns, and other semi-useful
stuff. Plus tests and an optomization to allow name=foo as the only parameter
to be just as fast as before.
Diffstat (limited to 'cobbler/action_status.py')
-rw-r--r-- | cobbler/action_status.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/cobbler/action_status.py b/cobbler/action_status.py index 158ee30..660fb42 100644 --- a/cobbler/action_status.py +++ b/cobbler/action_status.py @@ -17,6 +17,7 @@ import os import os.path import glob import time +import api as cobbler_api from rhpl.translate import _, N_, textdomain, utf8 @@ -99,6 +100,8 @@ class BootStatusReport: tracking will be incomplete. This should be noted in the docs. """ + api = cobbler_api.BootAPI() + apache_results = self.scan_apache_logfiles() syslog_results = self.scan_syslog_logfiles() ips = apache_results.keys() @@ -112,9 +115,9 @@ class BootStatusReport: last_recorded_time = 0 time_collisions = 0 - #header = ("Address", "State", "Started", "Last Request", "Seconds", "Log Entries") + #header = ("Name", "State", "Started", "Last Request", "Seconds", "Log Entries") print "%-20s | %-15s | %-25s | %-25s | %-10s | %-6s" % ( - _("Address"), + _("Name"), _("State"), _("Last Request"), _("Started"), @@ -150,20 +153,19 @@ class BootStatusReport: else: entries[logtime] = "1" - - self.generate_report(entries,ip) + name = api.systems().find(ip_address=ip).name + self.generate_report(entries,name) return True #----------------------------------------- - def generate_report(self,entries,ip): + def generate_report(self,entries,name): """ Given the information about transferred files and kickstart finish times, attempt to produce a report that most describes the state of the system. """ - # sort the access times rtimes = entries.keys() rtimes.sort() @@ -175,7 +177,7 @@ class BootStatusReport: fcount = 0 if len(rtimes) == 0: - print _("%s: ?") % ip + print _("%s: ?") % name return # for each request time the machine has made @@ -215,7 +217,7 @@ class BootStatusReport: # print the status line for this IP address print "%-20s | %-15s | %-25s | %-25s | %-10s | %-6s" % ( - ip, + name, install_state, display_start, display_last, |