| ... | ... |
@@ -398,25 +398,6 @@ _oc_start-build() |
| 398 | 398 |
must_have_one_noun=() |
| 399 | 399 |
} |
| 400 | 400 |
|
| 401 |
-_oc_build-logs() |
|
| 402 |
-{
|
|
| 403 |
- last_command="oc_build-logs" |
|
| 404 |
- commands=() |
|
| 405 |
- |
|
| 406 |
- flags=() |
|
| 407 |
- two_word_flags=() |
|
| 408 |
- flags_with_completion=() |
|
| 409 |
- flags_completion=() |
|
| 410 |
- |
|
| 411 |
- flags+=("--follow")
|
|
| 412 |
- flags+=("-f")
|
|
| 413 |
- flags+=("--nowait")
|
|
| 414 |
- flags+=("-w")
|
|
| 415 |
- |
|
| 416 |
- must_have_one_flag=() |
|
| 417 |
- must_have_one_noun=() |
|
| 418 |
-} |
|
| 419 |
- |
|
| 420 | 401 |
_oc_deploy() |
| 421 | 402 |
{
|
| 422 | 403 |
last_command="oc_deploy" |
| ... | ... |
@@ -2020,7 +2001,6 @@ _oc() |
| 2020 | 2020 |
commands+=("status")
|
| 2021 | 2021 |
commands+=("project")
|
| 2022 | 2022 |
commands+=("start-build")
|
| 2023 |
- commands+=("build-logs")
|
|
| 2024 | 2023 |
commands+=("deploy")
|
| 2025 | 2024 |
commands+=("rollback")
|
| 2026 | 2025 |
commands+=("new-build")
|
| ... | ... |
@@ -2208,25 +2208,6 @@ _openshift_cli_start-build() |
| 2208 | 2208 |
must_have_one_noun=() |
| 2209 | 2209 |
} |
| 2210 | 2210 |
|
| 2211 |
-_openshift_cli_build-logs() |
|
| 2212 |
-{
|
|
| 2213 |
- last_command="openshift_cli_build-logs" |
|
| 2214 |
- commands=() |
|
| 2215 |
- |
|
| 2216 |
- flags=() |
|
| 2217 |
- two_word_flags=() |
|
| 2218 |
- flags_with_completion=() |
|
| 2219 |
- flags_completion=() |
|
| 2220 |
- |
|
| 2221 |
- flags+=("--follow")
|
|
| 2222 |
- flags+=("-f")
|
|
| 2223 |
- flags+=("--nowait")
|
|
| 2224 |
- flags+=("-w")
|
|
| 2225 |
- |
|
| 2226 |
- must_have_one_flag=() |
|
| 2227 |
- must_have_one_noun=() |
|
| 2228 |
-} |
|
| 2229 |
- |
|
| 2230 | 2211 |
_openshift_cli_deploy() |
| 2231 | 2212 |
{
|
| 2232 | 2213 |
last_command="openshift_cli_deploy" |
| ... | ... |
@@ -3830,7 +3811,6 @@ _openshift_cli() |
| 3830 | 3830 |
commands+=("status")
|
| 3831 | 3831 |
commands+=("project")
|
| 3832 | 3832 |
commands+=("start-build")
|
| 3833 |
- commands+=("build-logs")
|
|
| 3834 | 3833 |
commands+=("deploy")
|
| 3835 | 3834 |
commands+=("rollback")
|
| 3836 | 3835 |
commands+=("new-build")
|
| ... | ... |
@@ -52,19 +52,6 @@ Attach to a running container. |
| 52 | 52 |
==== |
| 53 | 53 |
|
| 54 | 54 |
|
| 55 |
-== oc build-logs |
|
| 56 |
-Show logs from a build |
|
| 57 |
- |
|
| 58 |
-==== |
|
| 59 |
- |
|
| 60 |
-[options="nowrap"] |
|
| 61 |
- # Stream logs from container |
|
| 62 |
- $ openshift cli build-logs 566bed879d2d |
|
| 63 |
-==== |
|
| 64 |
- |
|
| 65 |
- |
|
| 66 | 55 |
== oc cancel-build |
| 67 | 56 |
Cancel a pending or running build |
| 68 | 57 |
|
| ... | ... |
@@ -502,22 +489,22 @@ Print the logs for a resource. |
| 502 | 502 |
|
| 503 | 503 |
[options="nowrap"] |
| 504 | 504 |
---- |
| 505 |
- # Returns snapshot of ruby-container logs from pod backend. |
|
| 506 |
- $ openshift cli logs backend -c ruby-container |
|
| 507 |
- |
|
| 508 |
- # Starts streaming of ruby-container logs from pod backend. |
|
| 509 |
- $ openshift cli logs -f pod/backend -c ruby-container |
|
| 505 |
+ # Start streaming the logs of the most recent build of the openldap build config. |
|
| 506 |
+ $ logs openshift cli -f bc/openldap |
|
| 510 | 507 |
|
| 511 |
- # Starts streaming the logs of the most recent build of the openldap build config. |
|
| 512 |
- $ openshift cli logs -f bc/openldap |
|
| 513 |
- |
|
| 514 |
- # Starts streaming the logs of the latest deployment of the mysql deployment config. |
|
| 515 |
- $ openshift cli logs -f dc/mysql |
|
| 508 |
+ # Start streaming the logs of the latest deployment of the mysql deployment config. |
|
| 509 |
+ $ logs openshift cli -f dc/mysql |
|
| 516 | 510 |
|
| 517 | 511 |
# Get the logs of the first deployment for the mysql deployment config. Note that logs |
| 518 | 512 |
# from older deployments may not exist either because the deployment was successful |
| 519 | 513 |
# or due to deployment pruning or manual deletion of the deployment. |
| 520 |
- $ openshift cli logs --version=1 dc/mysql |
|
| 514 |
+ $ logs openshift cli --version=1 dc/mysql |
|
| 515 |
+ |
|
| 516 |
+ # Return a snapshot of ruby-container logs from pod backend. |
|
| 517 |
+ $ logs openshift cli backend -c ruby-container |
|
| 518 |
+ |
|
| 519 |
+ # Start streaming of ruby-container logs from pod backend. |
|
| 520 |
+ $ logs openshift cli -f pod/backend -c ruby-container |
|
| 521 | 521 |
---- |
| 522 | 522 |
==== |
| 523 | 523 |
|
| ... | ... |
@@ -271,7 +271,7 @@ This section covers how to perform all the steps of building, deploying, and upd |
| 271 | 271 |
command below (substituting your build name from the "oc get builds" |
| 272 | 272 |
output). |
| 273 | 273 |
|
| 274 |
- $ oc build-logs ruby-sample-build-1 -n test |
|
| 274 |
+ $ oc logs build/ruby-sample-build-1 -n test |
|
| 275 | 275 |
|
| 276 | 276 |
The creation of the new image in the Docker registry will |
| 277 | 277 |
automatically trigger a deployment of the application, creating a |
| ... | ... |
@@ -110,7 +110,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) * |
| 110 | 110 |
Message: "Troubleshooting and Debugging Commands:", |
| 111 | 111 |
Commands: []*cobra.Command{
|
| 112 | 112 |
cmd.NewCmdExplain(fullName, f, out), |
| 113 |
- cmd.NewCmdLogs(fullName, f, out), |
|
| 113 |
+ cmd.NewCmdLogs(cmd.LogsRecommendedName, fullName, f, out), |
|
| 114 | 114 |
cmd.NewCmdRsh(cmd.RshRecommendedName, fullName, f, in, out, errout), |
| 115 | 115 |
rsync.NewCmdRsync(rsync.RsyncRecommendedName, fullName, f, out, errout), |
| 116 | 116 |
cmd.NewCmdExec(fullName, f, in, out, errout), |
| ... | ... |
@@ -37,7 +37,7 @@ func NewCmdBuildLogs(fullName string, f *clientcmd.Factory, out io.Writer) *cobr |
| 37 | 37 |
Short: "Show logs from a build", |
| 38 | 38 |
Long: buildLogsLong, |
| 39 | 39 |
Example: fmt.Sprintf(buildLogsExample, fullName), |
| 40 |
- SuggestFor: []string{"builds"},
|
|
| 40 |
+ Deprecated: fmt.Sprintf("use %q instead.", LogsRecommendedName),
|
|
| 41 | 41 |
Run: func(cmd *cobra.Command, args []string) {
|
| 42 | 42 |
err := RunBuildLogs(fullName, f, out, cmd, opts, args) |
| 43 | 43 |
|
| ... | ... |
@@ -19,28 +19,35 @@ import ( |
| 19 | 19 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
| 20 | 20 |
) |
| 21 | 21 |
|
| 22 |
+// LogsRecommendedName is the recommended command name |
|
| 23 |
+// TODO: Probably move this pattern upstream? |
|
| 24 |
+const LogsRecommendedName = "logs" |
|
| 25 |
+ |
|
| 22 | 26 |
const ( |
| 23 | 27 |
logsLong = ` |
| 24 | 28 |
Print the logs for a resource. |
| 25 | 29 |
|
| 26 |
-If the pod has only one container, the container name is optional.` |
|
| 27 |
- |
|
| 28 |
- logsExample = ` # Returns snapshot of ruby-container logs from pod backend. |
|
| 29 |
- $ %[1]s logs backend -c ruby-container |
|
| 30 |
- |
|
| 31 |
- # Starts streaming of ruby-container logs from pod backend. |
|
| 32 |
- $ %[1]s logs -f pod/backend -c ruby-container |
|
| 30 |
+Supported resources are builds, build configs (bc), deployment configs (dc), and pods. |
|
| 31 |
+When a pod is specified and has more than one container, the container name should be |
|
| 32 |
+specified via -c. When a build config or deployment config is specified, you can view |
|
| 33 |
+the logs for a particular version of it via --version.` |
|
| 33 | 34 |
|
| 34 |
- # Starts streaming the logs of the most recent build of the openldap build config. |
|
| 35 |
- $ %[1]s logs -f bc/openldap |
|
| 35 |
+ logsExample = ` # Start streaming the logs of the most recent build of the openldap build config. |
|
| 36 |
+ $ %[1]s -f bc/openldap |
|
| 36 | 37 |
|
| 37 |
- # Starts streaming the logs of the latest deployment of the mysql deployment config. |
|
| 38 |
- $ %[1]s logs -f dc/mysql |
|
| 38 |
+ # Start streaming the logs of the latest deployment of the mysql deployment config. |
|
| 39 |
+ $ %[1]s -f dc/mysql |
|
| 39 | 40 |
|
| 40 | 41 |
# Get the logs of the first deployment for the mysql deployment config. Note that logs |
| 41 | 42 |
# from older deployments may not exist either because the deployment was successful |
| 42 | 43 |
# or due to deployment pruning or manual deletion of the deployment. |
| 43 |
- $ %[1]s logs --version=1 dc/mysql` |
|
| 44 |
+ $ %[1]s --version=1 dc/mysql |
|
| 45 |
+ |
|
| 46 |
+ # Return a snapshot of ruby-container logs from pod backend. |
|
| 47 |
+ $ %[1]s backend -c ruby-container |
|
| 48 |
+ |
|
| 49 |
+ # Start streaming of ruby-container logs from pod backend. |
|
| 50 |
+ $ %[1]s -f pod/backend -c ruby-container` |
|
| 44 | 51 |
) |
| 45 | 52 |
|
| 46 | 53 |
// OpenShiftLogsOptions holds all the necessary options for running oc logs. |
| ... | ... |
@@ -53,14 +60,15 @@ type OpenShiftLogsOptions struct {
|
| 53 | 53 |
} |
| 54 | 54 |
|
| 55 | 55 |
// NewCmdLogs creates a new logs command that supports OpenShift resources. |
| 56 |
-func NewCmdLogs(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
|
|
| 56 |
+func NewCmdLogs(name, parent string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
|
|
| 57 | 57 |
o := OpenShiftLogsOptions{
|
| 58 | 58 |
KubeLogOptions: &kcmd.LogsOptions{},
|
| 59 | 59 |
} |
| 60 | 60 |
cmd := kcmd.NewCmdLog(f.Factory, out) |
| 61 | 61 |
cmd.Short = "Print the logs for a resource." |
| 62 | 62 |
cmd.Long = logsLong |
| 63 |
- cmd.Example = fmt.Sprintf(logsExample, fullName) |
|
| 63 |
+ cmd.Example = fmt.Sprintf(logsExample, name+" "+parent) |
|
| 64 |
+ cmd.SuggestFor = []string{"builds", "deployments"}
|
|
| 64 | 65 |
cmd.Run = func(cmd *cobra.Command, args []string) {
|
| 65 | 66 |
cmdutil.CheckErr(o.Complete(f, out, cmd, args)) |
| 66 | 67 |
if err := o.Validate(); err != nil {
|
| ... | ... |
@@ -16,7 +16,7 @@ import ( |
| 16 | 16 |
func TestFlagParity(t *testing.T) {
|
| 17 | 17 |
kubeCmd := kcmd.NewCmdLog(nil, ioutil.Discard) |
| 18 | 18 |
f := clientcmd.NewFactory(nil) |
| 19 |
- originCmd := NewCmdLogs("", f, ioutil.Discard)
|
|
| 19 |
+ originCmd := NewCmdLogs("oc", "logs", f, ioutil.Discard)
|
|
| 20 | 20 |
|
| 21 | 21 |
kubeCmd.LocalFlags().VisitAll(func(kubeFlag *pflag.Flag) {
|
| 22 | 22 |
originFlag := originCmd.LocalFlags().Lookup(kubeFlag.Name) |
| ... | ... |
@@ -260,7 +260,7 @@ func RunNewApplication(fullName string, f *clientcmd.Factory, out io.Writer, c * |
| 260 | 260 |
} |
| 261 | 261 |
case *buildapi.BuildConfig: |
| 262 | 262 |
if len(t.Spec.Triggers) > 0 {
|
| 263 |
- fmt.Fprintf(out, "%sBuild scheduled for %q - use the build-logs command to track its progress.\n", indent, t.Name) |
|
| 263 |
+ fmt.Fprintf(out, "%sBuild scheduled for %q - use the logs command to track its progress.\n", indent, t.Name) |
|
| 264 | 264 |
} |
| 265 | 265 |
case *imageapi.ImageStream: |
| 266 | 266 |
if len(t.Status.DockerImageRepository) == 0 {
|