Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2935fd69
Unverified
Commit
2935fd69
authored
Feb 21, 2018
by
Maciej Szulik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change printDeprecationWarning to use fmt.Fprintf instead of glog
parent
0bf25618
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
10 deletions
+12
-10
cmd.go
pkg/kubectl/cmd/cmd.go
+3
-4
exec.go
pkg/kubectl/cmd/exec.go
+1
-1
exec_test.go
pkg/kubectl/cmd/exec_test.go
+1
-0
logs.go
pkg/kubectl/cmd/logs.go
+2
-2
logs_test.go
pkg/kubectl/cmd/logs_test.go
+5
-3
No files found.
pkg/kubectl/cmd/cmd.go
View file @
2935fd69
...
@@ -32,7 +32,6 @@ import (
...
@@ -32,7 +32,6 @@ import (
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
"github.com/golang/glog"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
)
)
...
@@ -290,7 +289,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
...
@@ -290,7 +289,7 @@ func NewKubectlCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer) *cob
Message
:
"Troubleshooting and Debugging Commands:"
,
Message
:
"Troubleshooting and Debugging Commands:"
,
Commands
:
[]
*
cobra
.
Command
{
Commands
:
[]
*
cobra
.
Command
{
NewCmdDescribe
(
f
,
out
,
err
),
NewCmdDescribe
(
f
,
out
,
err
),
NewCmdLogs
(
f
,
out
),
NewCmdLogs
(
f
,
out
,
err
),
NewCmdAttach
(
f
,
in
,
out
,
err
),
NewCmdAttach
(
f
,
in
,
out
,
err
),
NewCmdExec
(
f
,
in
,
out
,
err
),
NewCmdExec
(
f
,
in
,
out
,
err
),
NewCmdPortForward
(
f
,
out
,
err
),
NewCmdPortForward
(
f
,
out
,
err
),
...
@@ -355,8 +354,8 @@ func runHelp(cmd *cobra.Command, args []string) {
...
@@ -355,8 +354,8 @@ func runHelp(cmd *cobra.Command, args []string) {
cmd
.
Help
()
cmd
.
Help
()
}
}
func
printDeprecationWarning
(
command
,
alias
string
)
{
func
printDeprecationWarning
(
errOut
io
.
Writer
,
command
,
alias
string
)
{
glog
.
Warningf
(
"%s is DEPRECATED and will be removed in a future version. Use %s instead."
,
alias
,
command
)
fmt
.
Fprintf
(
errOut
,
"%s is DEPRECATED and will be removed in a future version. Use %s instead."
,
alias
,
command
)
}
}
// deprecatedAlias is intended to be used to create a "wrapper" command around
// deprecatedAlias is intended to be used to create a "wrapper" command around
...
...
pkg/kubectl/cmd/exec.go
View file @
2935fd69
...
@@ -155,7 +155,7 @@ func (p *ExecOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, argsIn []s
...
@@ -155,7 +155,7 @@ func (p *ExecOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, argsIn []s
return
cmdutil
.
UsageErrorf
(
cmd
,
execUsageStr
)
return
cmdutil
.
UsageErrorf
(
cmd
,
execUsageStr
)
}
}
if
len
(
p
.
PodName
)
!=
0
{
if
len
(
p
.
PodName
)
!=
0
{
printDeprecationWarning
(
"exec POD_NAME"
,
"-p POD_NAME"
)
printDeprecationWarning
(
p
.
Err
,
"exec POD_NAME"
,
"-p POD_NAME"
)
if
len
(
argsIn
)
<
1
{
if
len
(
argsIn
)
<
1
{
return
cmdutil
.
UsageErrorf
(
cmd
,
execUsageStr
)
return
cmdutil
.
UsageErrorf
(
cmd
,
execUsageStr
)
}
}
...
...
pkg/kubectl/cmd/exec_test.go
View file @
2935fd69
...
@@ -138,6 +138,7 @@ func TestPodAndContainer(t *testing.T) {
...
@@ -138,6 +138,7 @@ func TestPodAndContainer(t *testing.T) {
cmd
:=
&
cobra
.
Command
{}
cmd
:=
&
cobra
.
Command
{}
options
:=
test
.
p
options
:=
test
.
p
options
.
Err
=
bytes
.
NewBuffer
([]
byte
{})
err
:=
options
.
Complete
(
f
,
cmd
,
test
.
args
,
test
.
argsLenAtDash
)
err
:=
options
.
Complete
(
f
,
cmd
,
test
.
args
,
test
.
argsLenAtDash
)
if
test
.
expectError
&&
err
==
nil
{
if
test
.
expectError
&&
err
==
nil
{
t
.
Errorf
(
"%s: unexpected non-error"
,
test
.
name
)
t
.
Errorf
(
"%s: unexpected non-error"
,
test
.
name
)
...
...
pkg/kubectl/cmd/logs.go
View file @
2935fd69
...
@@ -86,7 +86,7 @@ type LogsOptions struct {
...
@@ -86,7 +86,7 @@ type LogsOptions struct {
}
}
// NewCmdLogs creates a new pod logs command
// NewCmdLogs creates a new pod logs command
func
NewCmdLogs
(
f
cmdutil
.
Factory
,
out
io
.
Writer
)
*
cobra
.
Command
{
func
NewCmdLogs
(
f
cmdutil
.
Factory
,
out
,
errOut
io
.
Writer
)
*
cobra
.
Command
{
o
:=
&
LogsOptions
{}
o
:=
&
LogsOptions
{}
cmd
:=
&
cobra
.
Command
{
cmd
:=
&
cobra
.
Command
{
Use
:
"logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]"
,
Use
:
"logs [-f] [-p] (POD | TYPE/NAME) [-c CONTAINER]"
,
...
@@ -96,7 +96,7 @@ func NewCmdLogs(f cmdutil.Factory, out io.Writer) *cobra.Command {
...
@@ -96,7 +96,7 @@ func NewCmdLogs(f cmdutil.Factory, out io.Writer) *cobra.Command {
Example
:
logsExample
,
Example
:
logsExample
,
PreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
PreRun
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
if
len
(
os
.
Args
)
>
1
&&
os
.
Args
[
1
]
==
"log"
{
if
len
(
os
.
Args
)
>
1
&&
os
.
Args
[
1
]
==
"log"
{
printDeprecationWarning
(
"logs"
,
"log"
)
printDeprecationWarning
(
errOut
,
"logs"
,
"log"
)
}
}
},
},
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
...
...
pkg/kubectl/cmd/logs_test.go
View file @
2935fd69
...
@@ -69,7 +69,7 @@ func TestLog(t *testing.T) {
...
@@ -69,7 +69,7 @@ func TestLog(t *testing.T) {
tf
.
ClientConfig
=
defaultClientConfig
()
tf
.
ClientConfig
=
defaultClientConfig
()
buf
:=
bytes
.
NewBuffer
([]
byte
{})
buf
:=
bytes
.
NewBuffer
([]
byte
{})
cmd
:=
NewCmdLogs
(
f
,
buf
)
cmd
:=
NewCmdLogs
(
f
,
buf
,
buf
)
cmd
.
Flags
()
.
Set
(
"namespace"
,
"test"
)
cmd
.
Flags
()
.
Set
(
"namespace"
,
"test"
)
cmd
.
Run
(
cmd
,
[]
string
{
"foo"
})
cmd
.
Run
(
cmd
,
[]
string
{
"foo"
})
...
@@ -124,7 +124,8 @@ func TestValidateLogFlags(t *testing.T) {
...
@@ -124,7 +124,8 @@ func TestValidateLogFlags(t *testing.T) {
},
},
}
}
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
cmd
:=
NewCmdLogs
(
f
,
bytes
.
NewBuffer
([]
byte
{}))
buf
:=
bytes
.
NewBuffer
([]
byte
{})
cmd
:=
NewCmdLogs
(
f
,
buf
,
buf
)
out
:=
""
out
:=
""
for
flag
,
value
:=
range
test
.
flags
{
for
flag
,
value
:=
range
test
.
flags
{
cmd
.
Flags
()
.
Set
(
flag
,
value
)
cmd
.
Flags
()
.
Set
(
flag
,
value
)
...
@@ -183,7 +184,8 @@ func TestLogComplete(t *testing.T) {
...
@@ -183,7 +184,8 @@ func TestLogComplete(t *testing.T) {
},
},
}
}
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
cmd
:=
NewCmdLogs
(
f
,
bytes
.
NewBuffer
([]
byte
{}))
buf
:=
bytes
.
NewBuffer
([]
byte
{})
cmd
:=
NewCmdLogs
(
f
,
buf
,
buf
)
var
err
error
var
err
error
out
:=
""
out
:=
""
for
flag
,
value
:=
range
test
.
flags
{
for
flag
,
value
:=
range
test
.
flags
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment