Skip to content

Commit

Permalink
only updates for the card will end up in updater cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed May 25, 2024
1 parent 13a3468 commit fbd5ca2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions olaf/_internals/services/updater.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Service for interacting with the updater"""

import os

from loguru import logger

from ...common.service import Service
Expand All @@ -12,6 +14,8 @@ class UpdaterService(Service):
def __init__(self, updater: Updater):
super().__init__()
self._updater = updater
hostname = os.uname()[1]
self._hostname = hostname[7:] if hostname.startswith("oresat-") else hostname

def on_start(self):

Expand All @@ -26,9 +30,10 @@ def on_start(self):
def on_loop(self):
# check for update files in fwrite cache
for i in self.node.fwrite_cache.files("update"):
self._updater.add_update_archive(self.node.fwrite_cache.dir + "/" + i.name)
self.node.fwrite_cache.remove(i.name)
logger.info(f"updater moved {i.name} into update cache")
if i.card == self._hostname:
self._updater.add_update_archive(self.node.fwrite_cache.dir + "/" + i.name)
self.node.fwrite_cache.remove(i.name)
logger.info(f"updater moved {i.name} into update cache")

# check for flag to start a update
if self.node.od_read("updater", "update"):
Expand Down
2 changes: 1 addition & 1 deletion olaf/common/oresat_file_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def get(self, file_name: str, dir_path: str, copy: bool = False) -> str:

return dest

def files(self, keyword: str = "") -> list:
def files(self, keyword: str = "") -> list[OreSatFile]:
"""Return a list of files in the cache.
Parameters
Expand Down

0 comments on commit fbd5ca2

Please sign in to comment.