StorminStanley / st2workroom

Vagrant environment used to play with StackStorm, develop StackStorm for your environment, or develop on StackStorm itself!
Apache License 2.0
23 stars 21 forks source link

Escape hubot env variables #340

Closed enykeev closed 8 years ago

enykeev commented 8 years ago

Related to https://github.com/StackStorm/st2installer/pull/105

estee-tew commented 8 years ago

https://stackstorm.slack.com/archives/stackstorm/p1454348530003818

emedvedev commented 8 years ago

Testing password abcjid1!!11@--''"".

Installed fine, no runtime errors, but docker-hubot won't start:

ubuntu@ip-10-0-2-192:~$ service docker-hubot start
/etc/init.d/docker-hubot: 141: /etc/init.d/docker-hubot: Syntax error: Unterminated quoted string

Here's the escaped startup command from the init script:

    --net bridge -m 0b --detach=true -e ST2_AUTH_USERNAME='chatops_bot' -e ST2_AUTH_URL='https://em-test-docker:443/auth' -e HUBOT_HIPCHAT_PASSWORD='abcjid1\!\!11@--\'\'\"\"' -e ST2_WEBUI_URL='https://em-test-docker' -e NODE_TLS_REJECT_UNAUTHORIZED='0' -e ST2_AUTH_PASSWORD='GZP1a7T7iaBsmgYjHMwm35vQA6LAOwTd' -e EXPRESS_PORT='8081' -e HUBOT_LOG_LEVEL='debug' -e HUBOT_HIPCHAT_JID='adssds' -e ST2_API='https://em-test-docker:443/api' -e HUBOT_NAME='hubot' -e HUBOT_ADAPTER='hipchat' -e HUBOT_ALIAS='\!' -p 8081:8080 --restart=always --add-host em-test-docker:10.0.2.192 \
emedvedev commented 8 years ago

Tested the latest revision with docker-hubot, works fine and escapes stuff properly:

    --net bridge -m 0b --detach=true -e ST2_AUTH_USERNAME=chatops_bot -e ST2_AUTH_URL=https://em-test-docker2:443/auth -e HUBOT_HIPCHAT_PASSWORD=abcjid1\!\!11@--\'\'\"\" -e ST2_WEBUI_URL=https://em-test-docker2 -e NODE_TLS_REJECT_UNAUTHORIZED=0 -e ST2_AUTH_PASSWORD=djb9wFhqIlBYOspjbnTIABLS9BxzxG7Q -e EXPRESS_PORT=8081 -e HUBOT_LOG_LEVEL=debug -e HUBOT_HIPCHAT_JID=asasasas@aas.ru -e ST2_API=https://em-test-docker2:443/api -e HUBOT_NAME=hubot -e HUBOT_ADAPTER=hipchat -e HUBOT_ALIAS=\! -p 8081:8080 --restart=always --add-host em-test-docker2:10.0.2.223 \

LGTM, although I'd test it with a real HipChat bot first. Slack only has an alphanumeric token with dashes, so nothing to escape; I just used a random hipchat data without a "real" connection.

enykeev commented 8 years ago

Yep, seems like it solves the problem. I wasn't able to check legacy hubot.env since it looks like we have an unrelated problem with generating it. Wonder if we should fix it or just deprecate.

@manasdk do we need to do anything special for this and https://github.com/StackStorm/st2installer/pull/105 to end up in 1.3.1 or is it enough to just merge?

emedvedev commented 8 years ago

You'll need to merge the st2installer PR first, then tag it as a next release, and make a version change in https://github.com/StackStorm/st2workroom/blob/master/hieradata/role/st2.yaml.