-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug where environment variable contain space. #179
base: master
Are you sure you want to change the base?
Conversation
For example "ES_JAVA_OPTS=-Xms512m -Xmx512m"
Don't you think this changes should be applied only to env |
Bug was found where i used env and added condition when value is string type and containt space symbol. This condition true only for env option, so i don't added it. |
BTW, you can try following code snippet for your case: from six.moves import shlex_quote
docker.Container(
options={'env': 'ES_JAVA_OPTS=%s' % shlex_quote('-Xms512m -Xmx512m')},
) |
I need to use several environment variables and i use list of variables. If use shlex_quote I get next result |
it's OK. so does escaping work :) But you need use |
Yes, you are right. May be not need use my decision for all variants. Thanks. |
Don't work with list of env variables: @tasks.infrastructure
def master():
fab.env.master_env.extend([
"bootstrap.memory_lock=true",
'ES_JAVA_OPTS={}'.format(shlex_quote('-Xms512m -Xmx512m')),
])
fab.env.update(
roledefs={
'web': ['bars@test-ip'],
},
)
elasticsearch = tasks.ImageBuildDockerTasks(
build_path='./elasticsearch',
service=docker.Container(
name='elasticsearch',
image='registry:5000/logging/elasticsearch:latest',
options=dict(
publish='9200:9200',
network='web_bb_logging',
volume=['esdata:/usr/share/elasticsearch/data', ],
env=fab.env.master_env
# ulimit='memlock=-1:-1'
),
),
roles=['web']
) generate docker run command
|
For example "ES_JAVA_OPTS=-Xms512m -Xmx512m"