Merge pull request 'generic systemctl' (#193) from generic_systemctl into main

Reviewed-on: #193
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
Marius Eggert 2023-05-22 10:41:54 +02:00
commit 6182369e4f
1 changed files with 11 additions and 9 deletions

View File

@ -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]: