[ 
https://issues.apache.org/jira/browse/HAWQ-717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15273214#comment-15273214
 ] 

ASF GitHub Bot commented on HAWQ-717:
-------------------------------------

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()
    ```


> HAWQ hawq ssh-exkeys command should consider the string exactly as its given 
> at the command line prompt
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HAWQ-717
>                 URL: https://issues.apache.org/jira/browse/HAWQ-717
>             Project: Apache HAWQ
>          Issue Type: Bug
>            Reporter: bhuvnesh chaudhary
>            Assignee: Lei Chang
>
> HAWQ hawq ssh-exkeys command should consider the string exactly as its given 
> at the command line prompt.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to