Commit 75c66567 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

ci: Copy ssh keys

Add option for copying ssh keys to the created vm.
parent d5b90719
......@@ -203,6 +203,7 @@ class SynnefoCI(object):
server = self._wait_transition(server_id, "BUILD", "ACTIVE")
self.setup_fabric()"Setup firewall")
......@@ -252,6 +253,20 @@ class SynnefoCI(object):
self.write_config('server_port', server_port)
self.logger.debug("Server's ssh port is %s" % _green(server_port))
def _copy_ssh_keys(self):
authorized_keys = self.config.get("Deployment",
if os.path.exists(authorized_keys):
keyfile = '/tmp/' % fabric.env.user
_run('mkdir -p ~/.ssh && chmod 700 ~/.ssh', False)
fabric.put(authorized_keys, keyfile)
_run('cat %s >> ~/.ssh/authorized_keys' % keyfile, False)
_run('rm %s' % keyfile, False)
self.logger.debug("Uploaded ssh authorized keys")
self.logger.debug("No ssh keys found")
def write_config(self, option, value, section="Temporary Options"):
"""Write changes back to config file"""
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