control-center/serviced — pull request #1418 by wplu (2014-12-18 17:58:22+00:00)
Title: fixes CC-624: fixed help for service shell/run/attach/action/logs

https://jira.zenoss.com/browse/CC-624

additional issue with attach/action/logs (but not seen with proxy/metric), notice the "No help topic for 'blah'":
```
# plu@plu-9: serviced service attach
Incorrect Usage.

No help topic for 'attach'
NAME:
attach - Run an arbitrary command in a running service container

USAGE:
command attach [command options] [arguments...]

DESCRIPTION:
serviced service attach { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE } [COMMAND]

OPTIONS:
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)

# plu@plu-9: serviced service action
Incorrect Usage.

No help topic for 'action'
NAME:
action - Run a predefined action in a running service container

USAGE:
command action [command options] [arguments...]

DESCRIPTION:
serviced service action { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE } ACTION

OPTIONS:

# plu@plu-9: serviced service logs
Incorrect Usage.

No help topic for 'logs'
NAME:
logs - Output the logs of a running service container - calls docker logs

USAGE:
command logs [command options] [arguments...]

DESCRIPTION:
serviced service logs { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE }

OPTIONS:
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)

```

DEMO - correct help for run/shell with exit code 1 and help for attach/action/logs with exit code 0:
```
# plu@plu-9: grep -r Before: cli/cmd/
cli/cmd/service.go:	Before: c.cmdServiceProxy,
cli/cmd/service.go:	Before: c.cmdServiceShell,
cli/cmd/service.go:	Before: c.cmdServiceRun,
cli/cmd/service.go:	Before: c.cmdServiceAttach,
cli/cmd/service.go:	Before: c.cmdServiceAction,
cli/cmd/service.go:	Before: c.cmdServiceLogs,
cli/cmd/metric.go:	Before: c.cmdMetric,

# plu@plu-9: serviced service proxy
Incorrect Usage.

NAME:
proxy - Starts a server proxy for a container

USAGE:
command proxy [command options] [arguments...]

DESCRIPTION:
serviced service proxy SERVICEID INSTANCEID COMMAND

OPTIONS:
--forwarder-binary '/usr/local/serviced/resources/logstash/logstash-forwarder'	path to the logstash-forwarder binary
--forwarder-config '/etc/logstash-forwarder.conf'	path to the logstash-forwarder config file
--muxport '22250'	multiplexing port to use
--mux	enable port multiplexing
--keyfile	path to private key file (defaults to compiled in private keys
--certfile	path to public certificate file (defaults to compiled in public cert)
--endpoint '10.87.110.1:4979'	serviced endpoint address
--autorestart	restart process automatically when it finishes
--disable-metric-forwarding	disable forwarding of metrics for this container
--metric-forwarder-port ':22350'	the port the container processes send performance data to
--logstash	forward service logs via logstash-forwarder
--logstash-idle-flush-time '5s'	time duration for logstash to flush log messages
--logstash-settle-time '0s'	time duration to wait for logstash to flush log messages before closing
--virtual-address-subnet '10.3'	/16 subnet for virtual addresses
# plu@plu-9: echo $?
0

# plu@plu-9: serviced service shell
Incorrect Usage.

NAME:
serviced service shell - serviced service shell SERVICEID [COMMAND]

USAGE:
serviced service shell [global options] command [command options] [arguments...]

COMMANDS:

OPTIONS:
--saveas, -s	saves the service instance with the given name
--interactive, -i	runs the service instance as a tty
--mount '--mount option --mount option'	bind mount: HOST_PATH[,CONTAINER_PATH]
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)
--generate-bash-completion
--help, -h	show help
# plu@plu-9: echo $?
1

# plu@plu-9: serviced service run
Incorrect Usage.

NAME:
serviced service run - serviced service run SERVICEID COMMAND [ARGS]

USAGE:
serviced service run [global options] command [command options] [arguments...]

COMMANDS:

OPTIONS:
--interactive, -i	runs the service instance as a tty
--logtostderr	enable/disable detailed serviced run logging (false by default)
--logstash	enable/disable log stash (true by default)
--logstash-idle-flush-time '100ms'	time duration for logstash to flush log messages
--logstash-settle-time '5s'	time duration to wait for logstash to flush log messages before closing
--mount '--mount option --mount option'	bind mount: HOST_PATH[,CONTAINER_PATH]
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)
--user	container username used to run command
--generate-bash-completion
--help, -h	show help
# plu@plu-9: echo $?
1

# plu@plu-9: serviced service attach
Incorrect Usage.

NAME:
serviced service attach - serviced service attach { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE } [COMMAND]

USAGE:
serviced service attach [global options] command [command options] [arguments...]

COMMANDS:

OPTIONS:
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)
--generate-bash-completion
--help, -h	show help

NAME:
attach - Run an arbitrary command in a running service container

USAGE:
command attach [command options] [arguments...]

DESCRIPTION:
serviced service attach { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE } [COMMAND]

OPTIONS:
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)
# plu@plu-9: echo $?
0

# plu@plu-9: serviced service action
Incorrect Usage.

NAME:
serviced service action - serviced service action { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE } ACTION

USAGE:
serviced service action [global options] command [command options] [arguments...]

COMMANDS:

OPTIONS:
--generate-bash-completion
--help, -h	show help

NAME:
action - Run a predefined action in a running service container

USAGE:
command action [command options] [arguments...]

DESCRIPTION:
serviced service action { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE } ACTION

OPTIONS:
# plu@plu-9: echo $?
0

# plu@plu-9: serviced service logs
Incorrect Usage.

NAME:
serviced service logs - serviced service logs { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE }

USAGE:
serviced service logs [global options] command [command options] [arguments...]

COMMANDS:

OPTIONS:
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)
--generate-bash-completion
--help, -h	show help

NAME:
logs - Output the logs of a running service container - calls docker logs

USAGE:
command logs [command options] [arguments...]

DESCRIPTION:
serviced service logs { SERVICEID | SERVICENAME | DOCKERID | POOL/...PARENTNAME.../SERVICENAME/INSTANCE }

OPTIONS:
--endpoint '10.87.110.39:4979'	endpoint for remote serviced (example.com:4979)
# plu@plu-9: echo $?
0

# plu@plu-9: serviced metric
NAME:
serviced metric - Interact with metrics

USAGE:
serviced metric [global options] command [command options] [arguments...]

COMMANDS:
push	Push a metric value
help, h	Shows a list of commands or help for one command

OPTIONS:
--generate-bash-completion
--help, -h	show help
# plu@plu-9: echo $?
0

```