Hello,
Here are some simple patches to update anamon.py to support watching any file and it also updates the pre_anamon snippet to report on bootup.
This plays into our bigger goal of making a lab in a box spin of cobbler+fedora for install testing. This is step one, step two is to cut a hole in the box.
Bill Peck wrote:
Hello,
Here are some simple patches to update anamon.py to support watching any file and it also updates the pre_anamon snippet to report on bootup.
This plays into our bigger goal of making a lab in a box spin of cobbler+fedora for install testing. This is step one, step two is to cut a hole in the box.
cobbler mailing list cobbler@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/cobbler
Correction, Step one would be to actually attach the patches! :-)
From 127bc95f8fb227bcf73542fb62aa688d1d07dd00 Mon Sep 17 00:00:00 2001
From: Bill Peck bpeck@redhat.com Date: Sat, 10 Jan 2009 10:38:39 -0500 Subject: [PATCH] Allows anamon to be more flexible and monitor any files that you pass to it. This will be used for reporting files after boot.
--- aux/anamon.py | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/aux/anamon.py b/aux/anamon.py index cf82d98..d65175b 100644 --- a/aux/anamon.py +++ b/aux/anamon.py @@ -175,15 +175,24 @@ def anamon_loop(): watchlist = [alog, slog, dump, scrlog, mod, llog, kcfg] waitlist = [ilog, ilog2, ulog, ulog2]
+ if watchfiles: + watchlist = [] + for watchfile in watchfiles: + if os.path.exists(watchfile): + watchfilebase = os.path.basename(watchfile) + watchlog = WatchedFile(watchfile, watchfilebase) + watchlist.append(watchlog) + while 1: time.sleep(5)
- for watch in waitlist: - if alog.seen("step installpackages$") or (sysimage.stable() and watch.exists()): - print "Adding %s to watch list" % watch.alias - watchlist.append(watch) - waitlist.remove(watch) - + if not watchfiles: + for watch in waitlist: + if alog.seen("step installpackages$") or (sysimage.stable() and watch.exists()): + print "Adding %s to watch list" % watch.alias + watchlist.append(watch) + waitlist.remove(watch) + for wf in watchlist: wf.update()
@@ -193,6 +202,7 @@ server = "" port = "80" daemon = 1 debug = lambda x,**y: None +watchfiles = []
n = 0 while n < len(sys.argv): @@ -200,6 +210,9 @@ while n < len(sys.argv): if arg == '--name': n = n+1 name = sys.argv[n] + elif arg == '--watchfile': + n = n+1 + watchfiles.append(sys.argv[n]) elif arg == '--server': n = n+1 server = sys.argv[n]
cobbler@lists.fedorahosted.org