コード例 #1
0
ファイル: update_homesizes.py プロジェクト: MechanisM/pcp
    def handle(self, *args, **options):
        for iu in User.objects.all():
            try:
                iu.parms
            except Exception, e:
                logging.info(u"Chybí parms uživatele %s" % iu.username)
                logging.warning("^ catch only %s, pls" % type(e))
                continue

            homedir = iu.parms.home
            if not homedir:
                logging.info(u"Chybí home uživatele %s" % iu.username)
                continue

            rr = RawRequest(iu.parms.web_machine.ip)
            data = rr.run("du -s %s" % homedir)["stdout"]

            if data:
                raw = data.strip()
                if not raw:
                    logging.info(u"Chybí home uživatele %s" % iu.username)
                    continue

                kset("%s:homesize" % iu.username, str(int(raw.split("\t")[0]) * 1024), 4320)
            else:
                logging.info(u"Chybí home uživatele %s" % iu.username)
コード例 #2
0
ファイル: update_homesizes.py プロジェクト: goldenboy/pcp
    def handle(self, *args, **options):
        for iu in User.objects.all():
            try:
                iu.parms
            except Exception, e:
                logging.info(u"Chybí parms uživatele %s" % iu.username)
                logging.warning("^ catch only %s, pls" % type(e))
                continue

            homedir = iu.parms.home
            if not homedir:
                logging.info(u"Chybí home uživatele %s" % iu.username)
                continue

            rr = RawRequest(iu.parms.web_machine.ip)
            data = rr.run("du -s %s" % homedir)["stdout"]

            if data:
                raw = data.strip()
                if not raw:
                    logging.info(u"Chybí home uživatele %s" % iu.username)
                    continue

                kset("%s:homesize" % iu.username,
                     str(int(raw.split("\t")[0]) * 1024), 4320)
            else:
                logging.info(u"Chybí home uživatele %s" % iu.username)
コード例 #3
0
 def installed(self):
     rr = RawRequest(self.web_machine.ip)
     data = rr.run("cat /etc/passwd |grep ^%s:" % self.user.username)["stdout"].strip()
     return self.user.username in data