Peter Kolloch created MESOS-2859:
------------------------------------

             Summary: Semantics of CommandInfo shell/value/arguments are very 
confusing
                 Key: MESOS-2859
                 URL: https://issues.apache.org/jira/browse/MESOS-2859
             Project: Mesos
          Issue Type: Documentation
            Reporter: Peter Kolloch


CommandInfo includes the following fields:

  optional bool shell = 6 [default = true];
  optional string value = 3;
  repeated string arguments = 7;

There is some documentation for them which explains their behavior for the 
command executor but not for the docker executor:

https://github.com/apache/mesos/blob/master/include/mesos/mesos.proto#L280

Both executors work fairly differently when you use shell=false and arguments.

For the command executor, executing "echo $PORT" withOUT variable substitution 
could be achieved with shell=false value="/usr/bin/echo" 
arguments=["/usr/bin/echo", "$PORT"]. See 
https://github.com/apache/mesos/blob/0.22.1/src/launcher/executor.cpp#L245

For the docker executor, using the same arguments with the "ubuntu" image (no 
default entrypoint) would result in executing "/usr/bin/echo /usr/bin/echo 
$PORT" which is rather confusing. See 
https://github.com/apache/mesos/blob/0.22.1/src/docker/docker.cpp#L451-L457

For the command executor, I would propose to emphasize that for all sane use 
cases `arguments(0)` should be equal to `value` if you use shell = false.

It would also help to include some example, e.g.:

* Executing "python -m SimpleHTTPServer $PORT" with variable substitution => 
shell=true value="python -m SimpleHTTPServer $PORT", arguments are ignored
* Executing "echo $PORT" withOUT variable substitution => shell=false 
value="/usr/bin/echo" arguments=["/usr/bin/echo", "$PORT"]

In the case of docker you actually need to distinguish between containers with 
a default entrypoint and the ones without.

With the ubuntu image (without default endpoint) examples could be:

* Executing "python -m SimpleHTTPServer $PORT" with variable substitution => 
shell=true value="python -m SimpleHTTPServer $PORT", arguments are ignored
* Executing "echo $PORT" withOUT variable substitution => shell=false 
value="/usr/bin/echo" arguments=["$PORT"] OR arguments=["/usr/bin/echo", 
"$PORT"] 

Thanks!



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

Reply via email to