From f3e0495f12599cf37e77b87da3711e9ebcdd379b Mon Sep 17 00:00:00 2001 From: root Date: Thu, 24 Nov 2022 20:14:07 +0000 Subject: [PATCH] Implement command running through pylxd --- lxd_interface.py | 7 +++++++ setup.sh | 0 2 files changed, 7 insertions(+) mode change 100644 => 100755 setup.sh diff --git a/lxd_interface.py b/lxd_interface.py index f2ce301..dc01f56 100644 --- a/lxd_interface.py +++ b/lxd_interface.py @@ -24,3 +24,10 @@ def destroy_instance(container_name: str): instance.delete(wait=True) return True + + +def execute_command(container_name: str, command: str): + instance = lxd_client.instances.get(container_name) + result_tuple = instance.execute([command]) + + return result_tuple diff --git a/setup.sh b/setup.sh old mode 100644 new mode 100755