wazuh-qa icon indicating copy to clipboard operation
wazuh-qa copied to clipboard

DTT2 - Iteration 1 - Allocation module - Copy the port.txt file to the remote host dir for macStadium machines

Open c-bordon opened this issue 8 months ago • 0 comments

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)

c-bordon avatar May 31 '24 13:05 c-bordon