generic systemctl

This commit is contained in:
Robin Müller 2023-05-19 11:01:06 +02:00
parent 3b34d70c23
commit c7a7ca9f79

View File

@ -251,15 +251,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
int(input("Specify systemctl command type by key: ")) int(input("Specify systemctl command type by key: "))
) )
unit_name = input("Specify unit name: ") unit_name = input("Specify unit name: ")
cmd_data = bytearray([systemctl_cmd]) q.add_pus_tc(create_systemctl_cmd(systemctl_cmd, unit_name))
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,
)
)
elif op_code == OpCode.EXECUTE_SHELL_CMD_BLOCKING: elif op_code == OpCode.EXECUTE_SHELL_CMD_BLOCKING:
custom_cmd = input("Please specify command to execute: ") custom_cmd = input("Please specify command to execute: ")
q.add_pus_tc( 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: def list_directory_base_user_data() -> bytearray:
all_opt = int(input("Use all (-a) option (0/1) ?: ")) all_opt = int(input("Use all (-a) option (0/1) ?: "))
if all_opt not in [0, 1]: if all_opt not in [0, 1]: