]> git.ipfire.org Git - people/shoehn/ipfire.org.git/commitdiff
Merge branch 'master' of git://git.ipfire.org/ipfire.org
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Mar 2015 22:11:09 +0000 (23:11 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 1 Mar 2015 22:11:09 +0000 (23:11 +0100)
1  2 
webapp/backend/fireinfo.py

index 68da9a43da011aaeb74c8ebf3078f2328080e29d,1bf6747693ac9d2d4293cec6916b4f142e6310fb..42c961c7fb306b0f9c348434952db4a2bc8283d7
@@@ -72,9 -72,6 +72,9 @@@ class ProfileDict(object)
  
  class ProfileNetwork(ProfileDict):
        def __eq__(self, other):
 +              if other is None:
 +                      return False
 +
                if not self.has_red == other.has_red:
                        return False
  
@@@ -560,11 -557,11 +560,11 @@@ class Profile(Object)
  
        devices = property(get_devices, set_devices)
  
-       def count_device(self, vendor, model):
+       def count_device(self, subsystem, vendor, model):
                counter = 0
  
                for dev in self.devices:
-                       if dev.vendor == vendor and dev.model == model:
+                       if dev.subsystem == subsystem and dev.vendor == vendor and dev.model == model:
                                counter += 1
  
                return counter
        def appliance_id(self):
                if not hasattr(self, "_appliance_id"):
                        appliances = (
+                               ("fountainnetworks-prime", self._appliance_test_fountainnetworks_prime),
                                ("lightningwirelabs-eco", self._appliance_test_lightningwirelabs_eco),
                        )
  
  
        @property
        def appliance(self):
-               if self.appliance_id == "lightningwirelabs-eco":
-                       return "Lightning Wire Labs IPFire Eco Appliance"
+               if self.appliance_id == "fountainnetworks-prime":
+                       return "Fountain Networks - IPFire Prime Box"
+               elif self.appliance_id == "lightningwirelabs-eco":
+                       return "Lightning Wire Labs - IPFire Eco Appliance"
+       def _appliance_test_fountainnetworks_prime(self):
+               if not self.system == ("SECO", "0949"):
+                       return False
+               # Must have a wireless device
+               if self.count_device("usb", "148f", "5572") < 1:
+                       return False
+               return True
  
        def _appliance_test_lightningwirelabs_eco(self):
                if not self.system == ("MSI", "MS-9877"):
                        return False
  
                # Must have four Intel network adapters
-               network_adapters_count = self.count_device("8086", "10d3")
+               network_adapters_count = self.count_device("pci", "8086", "10d3")
                if not network_adapters_count == 4:
                        return False
  
@@@ -1238,10 -1249,6 +1252,10 @@@ class ProfileParser(Object)
                        for arg in self.__device_args:
                                args[arg] = _device.get(arg, None)
  
 +                      # Skip if the subsystem is not set
 +                      if not args.get("subsystem", None):
 +                              continue
 +
                        # Find the device or create a new one.
                        device = self.fireinfo.get_device(**args)
                        if not device:
@@@ -1361,8 -1368,9 +1375,9 @@@ class Fireinfo(Object)
                if res:
                        return res.count
  
-       def get_archives_count(self):
-               res = self.db.get("SELECT COUNT(*) AS count FROM fireinfo_profiles")
+       def get_total_updates_count(self, when=None):
+               res = self.db.get("SELECT COUNT(*) + SUM(updates) AS count \
+                       FROM fireinfo_profiles WHERE time_created <= then_or_now(%s)", when)
  
                if res:
                        return res.count