docker-archive / dockercloud-cli

CLI for Docker Cloud
https://cloud.docker.com/
Apache License 2.0
74 stars 40 forks source link

Improperly escaped double quotes #55

Closed JustinLivi closed 7 years ago

JustinLivi commented 7 years ago

Test 1

Input

docker-cloud exec <id> mongo --eval 'rs.initiate({_id:\"devReplSet\",version:1,members:[{_id:0,host:\"mongo-1:27017\"},{_id:1,host:\"mongo-2:27017\"}]})'

Response

MongoDB shell version: 3.2.12
2017-07-03T23:15:48.240+0000 E QUERY    [thread1] SyntaxError: unterminated string literal @(connect):1:14

exception: connect failed

Expected The command should run without syntax error

Test 2

Input

docker-cloud exec <id> echo "mongo --eval 'rs.initiate({_id:\"devReplSet\",version:1,members:[{_id:0,host:\"mongo-1:27017\"},{_id:1,host:\"mongo-2:27017\"}]})'"

Response

mongo --eval 'rs.initiate({_id:\"devReplSet\",version:1,members:[{_id:0,host:\"mongo-1:27017\"},{_id:1,host:\"mongo-2:27017\"}]})'

Expected

mongo --eval 'rs.initiate({_id:"devReplSet",version:1,members:[{_id:0,host:"mongo-1:27017"},{_id:1,host:"mongo-2:27017"}]})'

Solution

Are my expectations wrong? If so, how can I properly pass over double quotes?

From testing by directly connecting to the API with my own custom code, it appears that this may actually be an issue in the dockercloud stream API as opposed to the dockercloud-cli or even the underlying python-dockercloud. If there's a more appropriate location for me to open this issue please let me know, thanks!