Skip to content

Commit

Permalink
Merge pull request #17028 from juanvallejo/jvallejo/revert-PR-16387
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

prevent client from looking up specific node in `oc debug`

Reverts #16387
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1505698

PR #16387 prevented a debug pod from being created at all, if a
specified node-name pointed to a node that did not exist.

Although the patch aimed to make "debug" command failures more
immediate, a client should not attempt to retrieve a specific node in
the "debug" command, as there is no guarantee that the user has access
to retrieve node information. While this means that the "debug" command

cc @openshift/cli-review @smarterclayton
  • Loading branch information
openshift-merge-robot committed Oct 24, 2017
2 parents 230b6a1 + c051e87 commit 9ea8cea
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
15 changes: 0 additions & 15 deletions pkg/oc/cli/cmd/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,21 +275,6 @@ func (o *DebugOptions) Complete(cmd *cobra.Command, f *clientcmd.Factory, args [
}
}

// if a nodeName was specified, ensure node exists
if len(o.NodeName) > 0 {
r := f.NewBuilder(true).
NamespaceParam(cmdNamespace).
SingleResourceType().
ResourceTypeOrNameArgs(true, []string{"nodes", o.NodeName}...).
Flatten().
Do()

_, err := r.Infos()
if err != nil {
return err
}
}

config, err := f.ClientConfig()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion test/cmd/debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ os::cmd::expect_success_and_text "oc debug -t dc/test-deployment-config -o yaml"
os::cmd::expect_success_and_not_text "oc debug --tty=false dc/test-deployment-config -o yaml" 'tty'
os::cmd::expect_success_and_not_text "oc debug dc/test-deployment-config -o yaml -- /bin/env" 'stdin'
os::cmd::expect_success_and_not_text "oc debug dc/test-deployment-config -o yaml -- /bin/env" 'tty'
os::cmd::expect_failure_and_text "oc debug dc/test-deployment-config --node-name=invalid -- /bin/env" 'nodes "invalid" not found'
os::cmd::expect_failure_and_text "oc debug dc/test-deployment-config --node-name=invalid -- /bin/env" 'on node "invalid"'
# Does not require a real resource on the server
os::cmd::expect_success_and_not_text "oc debug -T -f examples/hello-openshift/hello-pod.json -o yaml" 'tty'
os::cmd::expect_success_and_text "oc debug -f examples/hello-openshift/hello-pod.json --keep-liveness --keep-readiness -o yaml" ''
Expand Down

0 comments on commit 9ea8cea

Please sign in to comment.