wazuh-qa
wazuh-qa copied to clipboard
DTT2 - Iteration 1 - Allocation module - Copy the port.txt file to the remote host dir for macStadium machines
To facilitate the maintenance of the machines created on the macStadium hosts by the DevOps team, it is necessary to copy the temporary file port.txt to the directory of the remote host of the machine to be able to easily identify which port that machine is occupying, so that, in If you need to release the machine manually, you can easily release the port.
tmp_port_file = str(self.path) + "/port.txt"
if str(self.host_identifier) == "macstadium":
if not Path(tmp_port_file).exists():
port = VagrantUtils.get_port(self.remote_host_parameters)
cmd = f"/usr/bin/ssh -i /Users/jenkins/.ssh/localhost -L {server_ip}:{port}:{ip}:22 -N 127.0.0.1 -f"
VagrantUtils.remote_command(cmd, self.remote_host_parameters)
with open(tmp_port_file, 'w') as f:
f.write(port)