Skip to content

Commit

Permalink
Mac; Transfer hostname to the VM when VM is created.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdoupe committed Sep 27, 2024
1 parent bdf5aef commit ebfb30a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dojo_plugin/utils/mac_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')
Expand Down

0 comments on commit ebfb30a

Please sign in to comment.