def main(): host = UniDomain.host() db = dbmcache.dbmNode(dbpath=host.config.cachedir) #FIXME: host/princ? dbmcache.update_dbm(host, db) db.close() db = dbmcache.dbmNode(dbpath=host.config.cachedir) print(db) keys = db.keys() keys.remove("__created__") print("verify existance of homedirectories under base \'%s\' " % BASEDIR) for uid in keys: dir, uidNumber = db[uid] dir = "%s/%s" % (BASEDIR, dir) if not uidNumber == "__removed__": uidNumber = int(uidNumber) if not os.access(dir, os.F_OK): create_home(dir, uid, uidNumber) else: os.chown(dir, uidNumber, 0) os.chmod(dir, 0700) # shutil.rmtree(dir) else: print("%s is removed from ldap, remove %s" % (uid,dir)) try: shutil.rmtree(dir) except OSError: pass
def main(): roger = UniDomain.janitor(KEYTAB=KEYTAB) urenew.aklog() sync_DB(roger) db = dbmcache.dbmNode(dbpath=roger.config["cachedir"]) pts = afslib.ProtectionServer() vos = afslib.VolumeServer() print(vos) print(db) keys = db.keys() keys.remove("__created__") for uid in keys: print "\n>>>>", "-" * 40, uid, "-" * 40, "<<<<\n" user = (uid, db.uDB[uid], "%s%s" % (AFSHOME_basepath, db.hDB[uid])) if not db.uDB[uid] == "__removed__": if not uid in pts.user.keys(): print("%s must be created in pts " % uid) afslib.setup_user(pts, vos, user, AFSHOME_fileserver, quota=DEFAULT_QUOTA) else: print("%s already exists in pts, skip. " % uid) else: if not uid in pts.user.keys(): print("%s already removed from pts, skip. " % uid) else: print("%s must be removed from pts and mountpathes." % uid) afslib.disable_user(pts, vos, user, AFSHOME_fileserver) print "\n", "AFS sync has terminated."
def main(): roger = UniDomain.janitor(KEYTAB=KEYTAB) urenew.aklog() sync_DB(roger) db = dbmcache.dbmNode(dbpath=roger.config["cachedir"]) pts = afslib.ProtectionServer() vos = afslib.VolumeServer() print(vos) print(db) keys = db.keys() keys.remove("__created__") for uid in keys: print "\n>>>>", "-"*40, uid, "-"*40, "<<<<\n" user = (uid, db.uDB[uid], "%s%s" % (AFSHOME_basepath, db.hDB[uid]) ) if not db.uDB[uid] == "__removed__": if not uid in pts.user.keys(): print("%s must be created in pts " % uid) afslib.setup_user(pts, vos, user, AFSHOME_fileserver, quota=DEFAULT_QUOTA) else: print("%s already exists in pts, skip. " % uid) else: if not uid in pts.user.keys(): print("%s already removed from pts, skip. " % uid) else: print("%s must be removed from pts and mountpathes." % uid) afslib.disable_user(pts, vos, user, AFSHOME_fileserver) print "\n","AFS sync has terminated."
import UniDomain.UniDomain as UniDomain import UniDomain.dbmcache as dbmcache host = UniDomain.host() db = dbmcache.dbmNode(dbpath=host.config["cachedir"])
def sync_DB(princ): db = dbmcache.dbmNode(dbpath=princ.config["cachedir"]) dbmcache.update_dbm(princ, db) db.close()