Beispiel #1
0
    def all(self):
        ret = []
        hosts = Host.all()
        for host in hosts:
            ret.append(host)

        return ret
Beispiel #2
0
    def add_host(self, ip, domain):
        if (len(ip) == 0 or len(domain) == 0):
            return

        updated = False
        hosts = db.GqlQuery("SELECT * FROM Host WHERE domain = :1 LIMIT 1", domain)
        for host in hosts:
            host.ip = ip
            try:
                db.put(host)
                updated = True
            except CapabilityDisabledError:
                return

        if (not updated):
            host = Host(ip = ip, domain = domain)
            try:
                host.put()
            except CapabilityDisabledError:
                pass

        return
Beispiel #3
0
 def del_all(self):
     hosts = Host.all()
     for host in hosts:
         host.delete()
Beispiel #4
0
    def count(self):
        count = 0
        hosts = Host.all()
        count = hosts.count()

        return count