Control board client regression fixes (#1394)

* Control board client should use new FileCmds initiator

* Restore informative logging, but drop to debug level

* Use the correct object to call list_images()
This commit is contained in:
Daniel Markstedt 2023-12-10 22:56:35 -08:00 committed by GitHub
parent 05b9e0eb18
commit 7268084819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 12 deletions

View File

@ -106,8 +106,9 @@ class CtrlBoardMenuUpdateEventHandler(Observer):
handler_function(info_object)
except AttributeError:
log = logging.getLogger(__name__)
log.error(
"Handler function not found or returned an error. Skipping.",
log.debug(
"Handler function [%s] not found or returned an error. Skipping.",
str(handler_function_name),
)
# noinspection PyUnusedLocal
@ -194,7 +195,7 @@ class CtrlBoardMenuUpdateEventHandler(Observer):
"""Method handles the rotary button press in the profile selection menu
for selecting a profile to load."""
if info_object is not None and "name" in info_object:
file_cmd = FileCmds(sock_cmd=self.sock_cmd, piscsi=self.piscsi_cmd)
file_cmd = FileCmds(piscsi=self.piscsi_cmd)
result = file_cmd.read_config(file_name=info_object["name"])
if result["status"] is True:
self._menu_controller.show_message("Profile loaded!")

View File

@ -28,12 +28,7 @@ class CtrlBoardMenuBuilder(MenuBuilder):
def __init__(self, piscsi_cmd: PiscsiCmds):
super().__init__()
self._piscsi_client = piscsi_cmd
self.file_cmd = FileCmds(
sock_cmd=piscsi_cmd.sock_cmd,
piscsi=piscsi_cmd,
token=piscsi_cmd.token,
locale=piscsi_cmd.locale,
)
self.file_cmd = FileCmds(piscsi=piscsi_cmd)
def build(self, name: str, context_object=None) -> Menu:
if name == CtrlBoardMenuBuilder.SCSI_ID_MENU:
@ -48,7 +43,7 @@ class CtrlBoardMenuBuilder(MenuBuilder):
return self.create_device_info_menu(context_object)
log = logging.getLogger(__name__)
log.error("Provided menu name cannot be built!")
log.debug("Provided menu name [%s] cannot be built!", name)
return self.create_scsi_id_list_menu(context_object)
@ -142,7 +137,7 @@ class CtrlBoardMenuBuilder(MenuBuilder):
def create_images_menu(self, context_object=None):
"""Creates a sub menu showing all the available images"""
menu = Menu(CtrlBoardMenuBuilder.IMAGES_MENU)
images_info = self.piscsi_cmd.list_images()
images_info = self._piscsi_client.list_images()
menu.add_entry("Return", {"context": self.IMAGES_MENU, "action": self.ACTION_RETURN})
images = images_info["files"]
sorted_images = sorted(images, key=lambda d: d["name"])

View File

@ -23,7 +23,7 @@ class Cycler:
self._menu_controller = menu_controller
self.sock_cmd = sock_cmd
self.piscsi_cmd = piscsi_cmd
self.file_cmd = FileCmds(sock_cmd=self.sock_cmd, piscsi=self.piscsi_cmd)
self.file_cmd = FileCmds(piscsi=self.piscsi_cmd)
self.cycle_entries = self.populate_cycle_entries()
self.return_string = return_string
self.return_entry = return_entry