summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-04-18 12:03:40 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-04-18 12:03:40 -0400
commitb15ca0fe01a01ee6792c857e766642d9d50ab760 (patch)
tree8cc0583910b2fb665a279bd6c2108d572ac40114
parentad17059740c03a4e503867d4c39bc3647502287c (diff)
downloadthird_party-cobbler-b15ca0fe01a01ee6792c857e766642d9d50ab760.zip
third_party-cobbler-b15ca0fe01a01ee6792c857e766642d9d50ab760.tar.gz
third_party-cobbler-b15ca0fe01a01ee6792c857e766642d9d50ab760.tar.xz
Finish removing mac from new install tracking
-rw-r--r--cobbler/action_status.py20
-rw-r--r--cobbler/modules/authn_testing.py42
-rw-r--r--triggers/status_post.trigger2
-rw-r--r--triggers/status_pre.trigger2
4 files changed, 50 insertions, 16 deletions
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 <mdehaan@redhat.com>
+
+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
+
+
diff --git a/triggers/status_post.trigger b/triggers/status_post.trigger
index 753cceb..f69afe2 100644
--- a/triggers/status_post.trigger
+++ b/triggers/status_post.trigger
@@ -9,7 +9,7 @@ name = sys.argv[2] # name of system or profile
ip = sys.argv[3] # ip or "?"
fd = open("/var/log/cobbler/install.log","a+")
-fd.write("%s\t%s\t%s\t%s\tstop\t%s\n" % (objtype,name,ip,time.time()))
+fd.write("%s\t%s\t%s\tstop\t%s\n" % (objtype,name,ip,time.time()))
fd.close()
sys.exit(0)
diff --git a/triggers/status_pre.trigger b/triggers/status_pre.trigger
index 8d6f6b6..95df1fb 100644
--- a/triggers/status_pre.trigger
+++ b/triggers/status_pre.trigger
@@ -9,7 +9,7 @@ name = sys.argv[2] # name of system or profile
ip = sys.argv[3] # ip or "?"
fd = open("/var/log/cobbler/install.log","a+")
-fd.write("%s\t%s\t%s\t%s\tstart\t%s\n" % (objtype,name,ip,time.time()))
+fd.write("%s\t%s\t%s\tstart\t%s\n" % (objtype,name,ip,time.time()))
fd.close()
sys.exit(0)