summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG4
-rw-r--r--MANIFEST.in1
-rw-r--r--cobbler.spec12
-rw-r--r--cobbler/syslog_watcher.py52
-rw-r--r--cobblersyslogd77
-rw-r--r--setup.py8
-rw-r--r--swatcher.py50
7 files changed, 150 insertions, 54 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 02d9b27..3006b2c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,10 @@
Cobbler CHANGELOG
(all entries mdehaan@redhat.com unless noted otherwise)
-* Fri Jan 19 2007 - 0.3.7
+* Mon Jan 21 2007 - 0.3.7
- Default/examples kickstarts are now fully automatic (added hd type/size detection).
+- Kickstart tracking now includes remote syslog support, just run "cobbler sync" to enable.
+- "cobbler status" command improved to include syslog info/times.
* Thu Dec 21 2006 - 0.3.6
- locking feature now enabled
diff --git a/MANIFEST.in b/MANIFEST.in
index b9c2f5e..22150e7 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -9,3 +9,4 @@ include cobbler.1.gz
include COPYING AUTHORS README CHANGELOG NEWS
include rsync.exclude
include watcher.py
+include cobblersyslogd
diff --git a/cobbler.spec b/cobbler.spec
index 7a3d037..e1d3e7d 100644
--- a/cobbler.spec
+++ b/cobbler.spec
@@ -32,6 +32,12 @@ Cobbler is a command line tool for configuration of network boot and update serv
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --optimize=1 --root=$RPM_BUILD_ROOT
+%post
+chkconfig --add cobblersyslogd
+
+%preun
+chkconfig --del cobblersyslogd
+
%clean
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
@@ -41,6 +47,7 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%dir /var/log/cobbler/kicklog
%defattr(-,root,root)
%{_bindir}/cobbler
+%{_bindir}/cobbler_syslogd
%dir /etc/cobbler
%config(noreplace) /etc/cobbler/default.ks
%config(noreplace) /etc/cobbler/kickstart_fc5.ks
@@ -55,13 +62,16 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%dir /var/lib/cobbler
/var/lib/cobbler/elilo-3.6-ia64.efi
/var/www/cobbler/watcher.py*
+/etc/init.d/cobblersyslogd
+%dir /var/log/cobbler/syslog
%doc AUTHORS CHANGELOG NEWS README COPYING
%changelog
-* Fri Dec 19 2007 Michael DeHaan <mdehaan@redhat.com> - 0.3.7-1
+* Mon Jan 21 2007 Michael DeHaan <mdehaan@redhat.com> - 0.3.7-1
- Upstream changes (see CHANGELOG)
+- Added packaging for new logfile directory and syslog watcher daemon
* Thu Dec 21 2006 Michael DeHaan <mdehaan@redhat.com> - 0.3.6-1
- Upstream changes (see CHANGELOG)
diff --git a/cobbler/syslog_watcher.py b/cobbler/syslog_watcher.py
new file mode 100644
index 0000000..4d3bf8a
--- /dev/null
+++ b/cobbler/syslog_watcher.py
@@ -0,0 +1,52 @@
+# cobbler daemon for logging remote syslog traffic during kickstart
+#
+# Copyright 2007, 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 socket
+import time
+
+import api as cobbler_api
+
+def main():
+
+ bootapi = cobbler_api.BootAPI()
+ settings = bootapi.settings()
+ port = settings.syslog_port
+
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ s.bind((socket.gethostname(), port))
+
+ buf = 1024
+
+ while 1:
+ data, addr = s.recvfrom(buf)
+ (ip, port) = addr
+ if not data:
+ break
+ else:
+ logfile = open("/var/log/cobbler/syslog/%s" % ip, "a+")
+ t = time.localtime()
+ # write numeric time
+ seconds = str(time.mktime(t))
+ logfile.write(seconds)
+ logfile.write("\t")
+ # write string time
+ timestr = str(time.asctime(t))
+ logfile.write(timestr)
+ logfile.write("\t")
+ # write the IP address of the client
+ logfile.write(ip)
+ logfile.write("\t")
+ # write the data
+ logfile.write(data)
+ logfile.write("\n")
+ logfile.close()
+
diff --git a/cobblersyslogd b/cobblersyslogd
new file mode 100644
index 0000000..d234a0d
--- /dev/null
+++ b/cobblersyslogd
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# cobblersyslogd Cobbler kickstart status monitor
+#
+# chkconfig: 345 99 99
+# description: This is a daemon which monitors and logs remote syslog traffic \
+# from machines being provisioned from cobbler. \
+# See http://cobbler.et.redhat.com
+#
+# processname: cobbler_syslogd
+# pidfile: /var/run/cobblersyslog.pid
+
+# Sanity checks.
+[ -x /usr/bin/cobbler_syslogd ] || exit 0
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+RETVAL=0
+
+start() {
+ if test -f /var/lock/subsys/cobbler_syslogd ; then
+ return 1
+ fi
+ echo -n $"Starting cobbler remote syslog monitor: "
+ /usr/bin/cobbler_syslogd
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cobbler_syslogd
+ return $RETVAL
+}
+
+
+stop() {
+ if ! test -f /var/lock/subsys/cobbler_syslogd ; then
+ return 1
+ fi
+ echo -n $"Stopping cobbler remote syslog monitor: "
+ pkill cobbler_syslogd
+ RETVAL=$?
+ rm /var/lock/subsys/cobbler_syslogd
+ echo
+ return $RETVAL
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ status)
+ status $processname
+ RETVAL=$?
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ condrestart)
+ if [ -f /var/lock/subsys/$servicename ]; then
+ stop
+ start
+ fi
+ ;;
+ reload)
+ echo "can't reload configuration, you have to restart it"
+ RETVAL=$?
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
+ ;;
+esac
+exit $RETVAL
+
diff --git a/setup.py b/setup.py
index 6f2b0a2..0b5f481 100644
--- a/setup.py
+++ b/setup.py
@@ -16,8 +16,10 @@ if __name__ == "__main__":
cobpath = "/var/lib/cobbler/"
etcpath = "/etc/cobbler/"
wwwpath = "/var/www/cobbler/"
+ initpath = "/etc/init.d/"
logpath = "/var/log/cobbler/"
logpath2 = "/var/log/cobbler/kicklog"
+ logpath3 = "/var/log/cobbler/syslog"
setup(
name="cobbler",
version = VERSION,
@@ -26,7 +28,7 @@ if __name__ == "__main__":
url = "http://cobbler.et.redhat.com/",
license = "GPL",
packages = ["cobbler","cobbler/yaml"],
- scripts = ["cobbler/cobbler"],
+ scripts = ["cobbler/cobbler", "cobbler/cobbler_syslogd"],
data_files = [
# (docspath, ['README']),
(wwwpath, ['watcher.py']),
@@ -37,8 +39,10 @@ if __name__ == "__main__":
(etcpath, ['default.pxe']),
(manpath, ['cobbler.1.gz']),
(etcpath, ['rsync.exclude']),
+ (initpath, ['cobblersyslogd']),
(logpath, []),
- (logpath2, [])
+ (logpath2, []),
+ (logpath3, [])
],
description = SHORT_DESC,
long_description = LONG_DESC
diff --git a/swatcher.py b/swatcher.py
deleted file mode 100644
index aa36401..0000000
--- a/swatcher.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# cobbler daemon for logging remote syslog traffic during kickstart
-#
-# Copyright 2007, 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 socket
-import time
-
-import cobbler.api as cobbler_api
-
-bootapi = cobbler_api.BootAPI()
-settings = bootapi.settings()
-port = settings.syslog_port
-
-s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
-s.bind((socket.gethostname(), port))
-
-buf = 1024
-
-while 1:
- data, addr = s.recvfrom(buf)
- (ip, port) = addr
- if not data:
- break
- else:
- logfile = open("/var/log/cobbler/syslog/%s" % ip, "a+")
- t = time.localtime()
- # write numeric time
- seconds = str(time.mktime(t))
- logfile.write(seconds)
- logfile.write("\t")
- # write string time
- timestr = str(time.asctime(t))
- logfile.write(timestr)
- logfile.write("\t")
- # write the IP address of the client
- logfile.write(ip)
- logfile.write("\t")
- # write the data
- logfile.write(data)
- logfile.write("\n")
- logfile.close()
-