[Frugalware-darcs] updatemgr: updatemgrd: fixed config parser

AlexExtreme alex at alex-smith.me.uk
Thu Sep 21 20:49:42 CEST 2006


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=updatemgr;a=darcs_commitdiff;h=20060921184543-46e39-3fc2a4238513b78c6bf87bfc4d9ffd774655bb1f.gz;

[updatemgrd: fixed config parser
AlexExtreme <alex at alex-smith.me.uk>**20060921184543
  * Config file can either live in the directory you run updatemgrd from or /etc
  * Both have the name updatemgrd.conf
  * The file takes this format:
 [settings]
 logfile: /path/where/logfile/should/be.log
 pidfile: /path/where/pidfile/should/be.pid
 checkinterval: <how many minutes between each check for updates>
] {
hunk ./updatemgrd/updatemgrd.py 36
-LOGFILE = '/home/alex/updatemgrd.log'
-PIDFILE = '/home/alex/updatemgrd.pid'
hunk ./updatemgrd/updatemgrd.py 73
-				open(PIDFILE,'w').write("%d" % pid)
+				open(self.pidfile,'w').write("%d" % pid)
hunk ./updatemgrd/updatemgrd.py 84
-		sys.stdout = sys.stderr = Log(open(LOGFILE, 'a+'))
+		sys.stdout = sys.stderr = Log(open(self.logfile, 'a+'))
hunk ./updatemgrd/updatemgrd.py 109
-				file = "/etc/updatrmgrd.conf"
+				file = "/etc/updatemgrd.conf"
hunk ./updatemgrd/updatemgrd.py 127
-				self.logfile = config.get("settings", "logfile")
+				self.logfile = confparse.get("settings", "logfile")
hunk ./updatemgrd/updatemgrd.py 133
-				self.pidfile = config.get("settings", "logfile")
+				self.pidfile = confparse.get("settings", "pidfile")
hunk ./updatemgrd/updatemgrd.py 139
-				self.checkinterval = config.get("settings", "checkinterval")
+				self.checkinterval = confparse.getint("settings", "checkinterval")
hunk ./updatemgrd/updatemgrd.py 150
+		self.parseConfig()
+		
+		self.debug("Logfile: %s" % (self.logfile))
+		self.debug("Pidfile: %s" % (self.pidfile))
+		self.debug("Checkinterval: %s" % (self.checkinterval))
+		
hunk ./updatemgrd/updatemgrd.py 160
-			time.sleep(20)
-			self.debug("foo")
+			self.debug("Hiee")
+			time.sleep(self.checkinterval)
}


More information about the Frugalware-darcs mailing list