Bug 1248463

Summary: wrong exec command help
Product: OKD Reporter: Aleksandar Kostadinov <akostadi>
Component: ocAssignee: Fabiano Franz <ffranz>
Status: CLOSED CURRENTRELEASE QA Contact: Yan Du <yadu>
Severity: low Docs Contact:
Priority: medium    
Version: 3.xCC: ffranz, jokerman, libra-bugs, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-12 17:11:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aleksandar Kostadinov 2015-07-30 11:04:32 UTC
Description of problem:

> $ oc help exec
> Execute a command in a container.
> 
> Usage:
>   oc exec POD -c CONTAINER -- COMMAND [args...] [options]

While it should be:
> oc exec POD -c CONTAINER [options] -- COMMAND [args...]

Version-Release number of selected component (if applicable):
1.0.2

Comment 1 Fabiano Franz 2016-01-11 15:16:24 UTC
Fixed in https://github.com/openshift/origin/pull/6607

Comment 2 openshift-github-bot 2016-01-12 14:45:59 UTC
Commit pushed to master at https://github.com/openshift/origin

https://github.com/openshift/origin/commit/a8939d6a819cfd8680764c71e1e5185f02eded09
Bug 1248463 - fixes exec help

Comment 3 Aleksandar Kostadinov 2016-01-13 07:12:05 UTC
>    # oc version
>    oc v1.1-761-g052c08b
>    kubernetes v1.1.0-origin-1107-g4c8e6f4
>     
>     
>    # oc help exec
>    Execute a command in a container
>     
>    Usage:
>      oc exec POD [-c CONTAINER] [options] -- COMMAND [args...] [options]
>     
>    Examples:
>      # Get output from running 'date' in ruby-container from pod 123456-7890
>      $ oc exec -p 123456-7890 -c ruby-container date
>     
>      # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780 and sends stdout/stderr from 'bash' back to the client
>      $ oc exec -p 123456-7890 -c ruby-container -i -t -- bash -il
>     
>    Options:
>      -c, --container='': Container name. If omitted, the first container in the pod will be chosen
>      -p, --pod='': Pod name
>      -i, --stdin=false: Pass stdin to the container
>      -t, --tty=false: Stdin is a TTY
>     
>    Use "oc options" for a list of global command-line options (applies to all commands).

You can see above that `[options]` is still listed after `--`. `oc` cannot accept options as described in help after `--`. This can confuse users non-savvy in linux shell.

Comment 4 Fabiano Franz 2016-03-10 13:41:57 UTC
Fixed the usage in https://github.com/openshift/origin/pull/7895.

Comment 5 Yan Du 2016-03-21 06:02:59 UTC
Test on latest env, issue have been fixed

# oc version
oc v3.2.0.5
kubernetes v1.2.0-36-g4a3f9c5


# oc help exec
Execute a command in a container

Usage:
  oc exec [options] POD [-c CONTAINER] -- COMMAND [args...]

Examples:
  # Get output from running 'date' in ruby-container from pod 123456-7890
  $ oc exec -p 123456-7890 -c ruby-container date

  # Switch to raw terminal mode, sends stdin to 'bash' in ruby-container from pod 123456-780 and sends stdout/stderr from 'bash' back to the client
  $ oc exec -p 123456-7890 -c ruby-container -i -t -- bash -il

Options:
  -c, --container='': Container name. If omitted, the first container in the pod will be chosen
  -p, --pod='': Pod name
  -i, --stdin=false: Pass stdin to the container
  -t, --tty=false: Stdin is a TTY

Use "oc options" for a list of global command-line options (applies to all commands).