def __init__(self,filename=None): session = Session() self.cfgparser = ConfigParser.ConfigParser() self.cfgparser.add_section("RIPPER") self.cfgparser.add_section("SHOUT") self.cfgparser.add_section("CONF_FILE") if (filename != None): self.filename = filename elif (os.getenv("BOSS_CONF") != None): self.filename = os.getenv("BOSS_CONF") else: #if (os.getlogin() == "root"): if session['userdir']: self.filename = session['userdir'] + "/.bossogg/bossogg.conf" elif os.geteuid() == 0: prefix = "/etc" if (sys.prefix != "/usr"): prefix = sys.prefix + "/etc" self.filename = prefix + "/bossogg.conf" else: self.filename = os.path.expanduser("~/.bossogg/bossogg.conf") Logger.log("Using config file:" + self.filename) if (os.path.exists(self.filename) == True): Logger.log("File Exists... opening") self.load() try: blah = self.get("version","CONF_FILE") if blah < self.version: self.set("version", "CONF_FILE", str(self.version)) self.save() except Exception: Logger.log("Conf file is too old. Removing and making a new one.",1) self.setDefaults() self.save() else: self.setDefaults() Logger.log("File Does Not Exist... creating") head, tail = os.path.split(self.filename) if (os.path.exists(head) == False): os.makedirs(head) self.save()
def shutdown(self): if self.theserver: Logger.log("Shutting down boss2 xmlrpc server") del self.theserver