Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4A2D02009F3 for ; Fri, 6 May 2016 00:14:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 48D13160A05; Thu, 5 May 2016 22:14:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 91189160A04 for ; Fri, 6 May 2016 00:14:35 +0200 (CEST) Received: (qmail 10936 invoked by uid 500); 5 May 2016 22:14:34 -0000 Mailing-List: contact dev-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list dev@hawq.incubator.apache.org Received: (qmail 10925 invoked by uid 99); 5 May 2016 22:14:34 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2016 22:14:34 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 2EFBDC0A88 for ; Thu, 5 May 2016 22:14:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -4.021 X-Spam-Level: X-Spam-Status: No, score=-4.021 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id EnLJ5c5S2Ydo for ; Thu, 5 May 2016 22:14:32 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 62AEC5F1B3 for ; Thu, 5 May 2016 22:14:31 +0000 (UTC) Received: (qmail 10784 invoked by uid 99); 5 May 2016 22:14:30 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 May 2016 22:14:30 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4E7A3DFC77; Thu, 5 May 2016 22:14:30 +0000 (UTC) From: bhuvnesh2703 To: dev@hawq.incubator.apache.org Reply-To: dev@hawq.incubator.apache.org References: In-Reply-To: Subject: [GitHub] incubator-hawq pull request: HAWQ-717: Use password as fed by the ... Content-Type: text/plain Message-Id: <20160505221430.4E7A3DFC77@git1-us-west.apache.org> Date: Thu, 5 May 2016 22:14:30 +0000 (UTC) archived-at: Thu, 05 May 2016 22:14:36 -0000 Github user bhuvnesh2703 commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/637#discussion_r62264233 --- Diff: tools/bin/hawq --- @@ -82,7 +83,13 @@ def main(): if len(sys.argv) > 2: hawq_command = sys.argv[1] second_arg = sys.argv[2] - sub_args = " ".join(sys.argv[2:]) + sub_args_list = sys.argv[2:] + # Password can have special characters like semicolon (;), quotes(", ') etc, convert input password to a string + if hawq_command == 'ssh-exkeys' and '-p' in sub_args_list: + password_index = sub_args_list.index('-p') + 1 + if len(sub_args_list) > password_index: + sub_arg_list[password_index] = json.dumps(sub_args_list[password_index]) --- End diff -- This is because we are printing that on the python console. So essentially, to json.dumps a string is passed which foo zzz json.dumps adds double quotes to it = "foo zzz" since on the python console the result is printed, to show that its a string python console adds single quotes to it. if you do the same using the script you will just get "foo zzz" ``` cat t1.py [gpadmin@c6401 ~]$ cat t1.py import json print json.dumps('foo zzz') [gpadmin@c6401 ~]$ python t1.py "foo zzz" [gpadmin@c6401 ~]$ python Python 2.6.2 (r262:71600, May 12 2009, 15:34:31) [GCC 4.1.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import json >>> json.dumps('foo zzz') '"foo zzz"' >>> quit() ``` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---