From b15ca0fe01a01ee6792c857e766642d9d50ab760 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 18 Apr 2008 12:03:40 -0400 Subject: Finish removing mac from new install tracking --- cobbler/action_status.py | 20 ++++++------------- cobbler/modules/authn_testing.py | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 cobbler/modules/authn_testing.py (limited to 'cobbler') diff --git a/cobbler/action_status.py b/cobbler/action_status.py index df5062e..79f9083 100644 --- a/cobbler/action_status.py +++ b/cobbler/action_status.py @@ -27,8 +27,7 @@ MOST_RECENT_STOP = 1 MOST_RECENT_TARGET = 2 SEEN_START = 3 SEEN_STOP = 4 -MAC = 5 -STATE = 6 +STATE = 5 class BootStatusReport: @@ -58,17 +57,17 @@ class BootStatusReport: tokens = line.split() if len(tokens) == 0: continue - (profile_or_system, name, mac, ip, start_or_stop, ts) = tokens - self.catalog(profile_or_system,name,mac,ip,start_or_stop,ts) + (profile_or_system, name, ip, start_or_stop, ts) = tokens + self.catalog(profile_or_system,name,ip,start_or_stop,ts) fd.close() # ------------------------------------------------------ - def catalog(self,profile_or_system,name,mac,ip,start_or_stop,ts): + def catalog(self,profile_or_system,name,ip,start_or_stop,ts): ip_data = self.ip_data if not ip_data.has_key(ip): - ip_data[ip] = [ -1, -1, "?", 0, 0, "?", "?" ] + ip_data[ip] = [ -1, -1, "?", 0, 0, "?" ] elem = ip_data[ip] ts = float(ts) @@ -78,27 +77,23 @@ class BootStatusReport: mrtarg = elem[MOST_RECENT_TARGET] snstart = elem[SEEN_START] snstop = elem[SEEN_STOP] - snmac = elem[MAC] if start_or_stop == "start": if mrstart < ts: mrstart = ts mrtarg = "%s:%s" % (profile_or_system, name) - snmac = mac elem[SEEN_START] = elem[SEEN_START] + 1 if start_or_stop == "stop": if mrstop < ts: mrstop = ts mrtarg = "%s:%s" % (profile_or_system, name) - snmac = mac elem[SEEN_STOP] = elem[SEEN_STOP] + 1 elem[MOST_RECENT_START] = mrstart elem[MOST_RECENT_STOP] = mrstop elem[MOST_RECENT_TARGET] = mrtarg - elem[MAC] = mac # ------------------------------------------------------- @@ -125,14 +120,12 @@ class BootStatusReport: return self.ip_data def get_printable_results(self): - # ip | last mac | last target | start | stop | count - format = "%-15s|%-17s|%-20s|%-17s|%-17s" + format = "%-15s|%-20s|%-17s|%-17s" ip_data = self.ip_data ips = ip_data.keys() ips.sort() line = ( "ip", - "mac", "target", "start", "state", @@ -142,7 +135,6 @@ class BootStatusReport: elem = ip_data[ip] line = ( ip, - elem[MAC], elem[MOST_RECENT_TARGET], time.ctime(elem[MOST_RECENT_START]), elem[STATE] diff --git a/cobbler/modules/authn_testing.py b/cobbler/modules/authn_testing.py new file mode 100644 index 0000000..cd74cdf --- /dev/null +++ b/cobbler/modules/authn_testing.py @@ -0,0 +1,42 @@ +""" +Authentication module that denies everything. +Unsafe demo. Allows anyone in with testing/testing. + +Copyright 2007-2008, Red Hat, Inc +Michael DeHaan + +This software may be freely redistributed under the terms of the GNU +general public license. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +""" + +import distutils.sysconfig +import sys + +plib = distutils.sysconfig.get_python_lib() +mod_path="%s/cobbler" % plib +sys.path.insert(0, mod_path) + + +def register(): + """ + The mandatory cobbler module registration hook. + """ + return "authn" + +def authenticate(api_handle,username,password): + """ + Validate a username/password combo, returning True/False + + Thanks to http://trac.edgewall.org/ticket/845 for supplying + the algorithm info. + """ + + if username == "testing" and password == "testing": + return True + return False + + -- cgit