From ebfb30a96af22f11e8602e11665d5b02e808baee Mon Sep 17 00:00:00 2001 From: Adam Doupe Date: Fri, 27 Sep 2024 23:15:51 +0000 Subject: [PATCH] Mac; Transfer hostname to the VM when VM is created. --- dojo_plugin/utils/mac_docker.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dojo_plugin/utils/mac_docker.py b/dojo_plugin/utils/mac_docker.py index a3ae198b..6da72c1f 100644 --- a/dojo_plugin/utils/mac_docker.py +++ b/dojo_plugin/utils/mac_docker.py @@ -107,11 +107,11 @@ def create(self, image, entrypoint=None, name=None, hostname=None, user=None, unique_id = output.strip().split(' ')[1] # Status is always running after create vm = {'id': unique_id, 'status': 'running'} - time.sleep(1) # set up the timeout container = MacContainer(self.client, vm) - # disable and do on the image now - # container.exec_run(f"nohup bash -c 'sleep {MAC_TIMEOUT_SECONDS} && echo \"VM and all files going away in 5 minutes, better save now\" | wall && sleep 300 && echo \"VM and all files going away in 1 minute, last warning\" | wall && sleep 60 && shutdown -h now' > /dev/null &", user="0") + # we want to setup the hostname if it exists + if hostname: + container.exec_run("cat - > /Users/admin/hostname", input=hostname.encode()) return container else: raise Exception(f'Error creating container: {image=} {name=} {output}')