Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

Commit

Permalink
Add docstrings to insecure_services() and set_deb_packages().
Browse files Browse the repository at this point in the history
  • Loading branch information
a-martynovich committed Sep 9, 2019
1 parent b1058d7 commit fc39ad4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions backend/device_registry/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,19 @@ def certificate_expired(self):
]
@property
def insecure_services(self):
"""
Get a list of deb packages which are marked "insecure", i.e. their names are in INSECURE_SERVICES list.
:return: list of DebPackage or None if set_deb_packages() wasn't called before.
"""
if not self.deb_packages_hash:
return None
return self.deb_packages.filter(name__in=self.INSECURE_SERVICES)

def set_deb_packages(self, packages):
"""
Assign the list of installed deb packages to this device.
:param packages: list of dicts with the following values: 'name': str, 'version': str, 'arch': DebPackage.Arch.
"""
packages_set = set((p['name'], p['version'], p['arch']) for p in packages)

# Find which packages we already have in db.
Expand Down

0 comments on commit fc39ad4

Please sign in to comment.