Hello Sander Hoentjen,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/12191

to review the following change.

Change subject: Use vncviewer passwordFile instead of passwdInput
......................................................................

Use vncviewer passwordFile instead of passwdInput

Fedora 18 has dropped the patch to add passwdInput option to tigervnc

Change-Id: I76178f15217c421d88879c88534d7cb3a7583426
Signed-off-by: Sander Hoentjen <san...@hoentjen.eu>
---
M src/cli/messages.py
M src/ovirtcli/platform/posix/vnc.py
2 files changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/91/12191/1

diff --git a/src/cli/messages.py b/src/cli/messages.py
index 6d6a573..21bacc5 100644
--- a/src/cli/messages.py
+++ b/src/cli/messages.py
@@ -30,6 +30,7 @@
         NO_ID = '"--id" argument is not available for this type of %s.'
         NO_NAME = '"--name" argument is not available for this type of show.'
         NO_CONSOLE_FOUND = '%s viewer was not found, please install %s first.'
+        NO_SUCH_COMMAND = '%s command was not found, please install it first.'
         NOT_CONNECTED = OvirtCliSettings.PRODUCT.lower() + '-shell is not 
connected.'
         NO_SUCH_COLLECTION = 'no such collection "%s" or given arguments not 
valid.'
         NO_CERTIFICATES = 'server CA certificate file must be specified for 
SSL secured connection.'
diff --git a/src/ovirtcli/platform/posix/vnc.py 
b/src/ovirtcli/platform/posix/vnc.py
index f6919ab..81de9dc 100644
--- a/src/ovirtcli/platform/posix/vnc.py
+++ b/src/ovirtcli/platform/posix/vnc.py
@@ -19,6 +19,7 @@
 from cli.error import Error
 from ovirtcli.platform import util
 from cli.messages import Messages
+from subprocess import Popen, PIPE
 
 
 def launch_vnc_viewer(host, port, ticket, debug=False):
@@ -29,7 +30,12 @@
     cmd = util.which('vncviewer')
     if cmd is None:
         raise Error, Messages.Error.NO_CONSOLE_FOUND % ('vnc', 'vnc')
-    args = ['vncviewer', '%s::%s' % (host, port), '-passwdInput' ]
+    cmd_passwd = util.which('vncpasswd')
+    if cmd_passwd is None:
+        raise Error, Messages.Error.NO_SUCH_COMMAND % 'vncpasswd'
+    p = Popen([cmd_passwd, "-f"], shell=False, stdin=PIPE, stdout=PIPE)
+    password = p.communicate(input=ticket)[0]
+    args = [cmd, '%s::%s' % (host, port), '-passwordFile', '/dev/stdin' ]
     pid, pstdin = util.spawn(cmd, args, debug)
-    os.write(pstdin, ticket)
+    os.write(pstdin, password)
     os.close(pstdin)


--
To view, visit http://gerrit.ovirt.org/12191
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76178f15217c421d88879c88534d7cb3a7583426
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: cli_3.2
Gerrit-Owner: Michael Pasternak <mpast...@redhat.com>
Gerrit-Reviewer: Sander Hoentjen <san...@hoentjen.eu>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to