#28 [backend] allow specifying ssh identity file
Merged 7 years ago by clime. Opened 7 years ago by praiskup.
Unknown source ssh-key-file  into  master

@@ -300,6 +300,8 @@

          opts.ssh = Munch()

          opts.ssh.port = _get_conf(

              cp, "ssh", "port", 22, mode="int")

+         opts.ssh.identity_file = _get_conf(

+             cp, "ssh", "identity_file", None, mode="path")

  

          opts.msg_buses = []

          for bus_config in glob.glob('/etc/copr/msgbuses/*.conf'):

@@ -90,7 +90,8 @@

          conn = paramiko.SSHClient()

          conn.set_missing_host_key_policy(paramiko.AutoAddPolicy())

          conn.connect(hostname=self.hostname, port=self.opts.ssh.port,

-                      username=username or self.opts.build_user)

+                      username=username or self.opts.build_user,

+                      key_filename=self.opts.ssh.identity_file)

          return conn

  

      def _run_ssh_cmd(self, cmd, as_root=False):

@@ -34,7 +34,8 @@

          conn = paramiko.SSHClient()

          conn.set_missing_host_key_policy(paramiko.AutoAddPolicy())

          conn.connect(hostname=vm_ip, port=opts.ssh.port,

-                      username=opts.build_user or "root")

+                      username=opts.build_user or "root",

+                      key_filename=opts.ssh.identity_file)

          stdin, stdout, stderr = conn.exec_command("echo hello")

          stdout.channel.recv_exit_status()

      except Exception as error:

@@ -105,3 +105,4 @@

  

  [ssh]

  port=2222

+ # identity_file=