tags 505936 + patch

Hi Adrian,
On Tue, Dec 02, 2008 at 09:17:14AM +0000, Adrian Bridgett wrote:
> seconded.  Guido - it _would_ do but there are some hardcoded bits.
> 
> The attached two patches fixes that.
Thanks for the patch. However it changes behaviour for existing
installations so we should default to root if no username was given.
I'll upload a fixed package with the attached patch soonish.
Cheers,
 -- Guido
# HG changeset patch
# User Guido Günther <[EMAIL PROTECTED]>
# Date 1228418962 -3600
# Node ID 6a29ab18aba161bdf1c2d1b1492439e5cb293ac0
# Parent  590b9afe9e7d50f5ea733b290b1255fc78e8fb9f
Allow different username for <hv>+ssh://

diff -r 590b9afe9e7d -r 6a29ab18aba1 src/virtManager/connect.py
--- a/src/virtManager/connect.py	Mon Dec 01 14:37:58 2008 -0500
+++ b/src/virtManager/connect.py	Thu Dec 04 20:29:22 2008 +0100
@@ -216,6 +216,11 @@
             auto = self.window.get_widget("autoconnect").get_active()
         uri = None
 
+        if conn == CONN_SSH and '@' in host:
+            user, host = host.split('@',1)
+        else:
+            user = "root"
+
         readOnly = None
         if hv == -1:
             pass
@@ -225,7 +230,8 @@
             elif conn == CONN_TLS:
                 uri = "xen+tls://" + host + "/"
             elif conn == CONN_SSH:
-                uri = "xen+ssh://root@" + host + "/"
+
+                uri = "xen+ssh://" + user + "@" + host + "/"
             elif conn == CONN_TCP:
                 uri = "xen+tcp://" + host + "/"
         else:
@@ -234,7 +240,7 @@
             elif conn == CONN_TLS:
                 uri = "qemu+tls://" + host + "/system"
             elif conn == CONN_SSH:
-                uri = "qemu+ssh://root@" + host + "/system"
+                uri = "qemu+ssh://" + user + "@" + host + "/system"
             elif conn == CONN_TCP:
                 uri = "qemu+tcp://" + host + "/system"
 

Reply via email to