diff --git a/eive_tmtc/tmtc/core.py b/eive_tmtc/tmtc/core.py index 461cc1f..fb138e9 100644 --- a/eive_tmtc/tmtc/core.py +++ b/eive_tmtc/tmtc/core.py @@ -251,15 +251,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str): int(input("Specify systemctl command type by key: ")) ) unit_name = input("Specify unit name: ") - cmd_data = bytearray([systemctl_cmd]) - cmd_data.extend(unit_name.encode()) - q.add_pus_tc( - create_action_cmd( - object_id=CORE_CONTROLLER_ID, - action_id=ActionId.SYSTEMCTL_CMD_EXECUTOR, - user_data=cmd_data, - ) - ) + q.add_pus_tc(create_systemctl_cmd(systemctl_cmd, unit_name)) elif op_code == OpCode.EXECUTE_SHELL_CMD_BLOCKING: custom_cmd = input("Please specify command to execute: ") q.add_pus_tc( @@ -458,6 +450,16 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str): ) +def create_systemctl_cmd(systemctl_cmd: SystemctlCmd, unit_name: str): + cmd_data = bytearray([systemctl_cmd]) + cmd_data.extend(unit_name.encode()) + return create_action_cmd( + object_id=CORE_CONTROLLER_ID, + action_id=ActionId.SYSTEMCTL_CMD_EXECUTOR, + user_data=cmd_data, + ) + + def list_directory_base_user_data() -> bytearray: all_opt = int(input("Use all (-a) option (0/1) ?: ")) if all_opt not in [0, 1]: