class ProfileNetwork(ProfileDict):
def __eq__(self, other):
+ if other is None:
+ return False
+
if not self.has_red == other.has_red:
return False
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
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:
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