Revision 5c3b5c9f ci/utils.py

b/ci/utils.py
203 203

  
204 204
        server = self._wait_transition(server_id, "BUILD", "ACTIVE")
205 205
        self._get_server_ip_and_port(server)
206
        self._copy_ssh_keys()
206 207

  
207 208
        self.setup_fabric()
208 209
        self.logger.info("Setup firewall")
......
252 253
        self.write_config('server_port', server_port)
253 254
        self.logger.debug("Server's ssh port is %s" % _green(server_port))
254 255

  
256
    @_check_fabric
257
    def _copy_ssh_keys(self):
258
        authorized_keys = self.config.get("Deployment",
259
                                          "ssh_keys")
260
        if os.path.exists(authorized_keys):
261
            keyfile = '/tmp/%s.pub' % fabric.env.user
262
            _run('mkdir -p ~/.ssh && chmod 700 ~/.ssh', False)
263
            fabric.put(authorized_keys, keyfile)
264
            _run('cat %s >> ~/.ssh/authorized_keys' % keyfile, False)
265
            _run('rm %s' % keyfile, False)
266
            self.logger.debug("Uploaded ssh authorized keys")
267
        else:
268
            self.logger.debug("No ssh keys found")
269

  
255 270
    def write_config(self, option, value, section="Temporary Options"):
256 271
        """Write changes back to config file"""
257 272
        try:

Also available in: Unified diff