Commit ea312629 authored by Alex Pyrgiotis's avatar Alex Pyrgiotis

ci: Add ssh port option

Add an option to connect to a specific ssh port of the created VM.
It is mainly useful when running ci from a VM in demo.synnefo.org. In
this case, we don't want to deduct the ssh port from the returned
server IP since the demo's DNAT applies only to connections out of the
demo's private network.
parent b0992f2b
......@@ -59,6 +59,9 @@ ssh_keys = ~/.ssh/id_rsa.pub
allocate_floating_ip = True
# List of networks IDs (comma seperated) to connect server
private_networks =
# Connect to a specific ssh port. If not set, the ssh port is calculated
# automatically.
ssh_port =
[Burnin]
......
......@@ -496,14 +496,19 @@ class SynnefoCI(object):
# Use the first network as IPv4
server_ip = networks[0]['ipv4']
if (".okeanos.io" in self.cyclades_client.base_url or
".demo.synnefo.org" in self.cyclades_client.base_url):
tmp1 = int(server_ip.split(".")[2])
tmp2 = int(server_ip.split(".")[3])
server_ip = "gate.okeanos.io"
server_port = 10000 + tmp1 * 256 + tmp2
# Check if config has ssh_port option and if so, use that port.
if self.config.has_option("Deployment", "ssh_port"):
server_port = self.config.get("Deployment", "ssh_port")
else:
server_port = 22
if (".okeanos.io" in self.cyclades_client.base_url or
".demo.synnefo.org" in self.cyclades_client.base_url):
tmp1 = int(server_ip.split(".")[2])
tmp2 = int(server_ip.split(".")[3])
server_ip = "gate.okeanos.io"
server_port = 10000 + tmp1 * 256 + tmp2
else:
server_port = 22
self.write_temp_config('server_ip', server_ip)
self.logger.debug("Server's IPv4 is %s" % _green(server_ip))
self.write_temp_config('server_port', server_port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment