hawq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhuvnesh2703 <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request: HAWQ-717: Use password as fed by the ...
Date Thu, 05 May 2016 22:14:30 GMT
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.
---

Mime
View raw message