-
Notifications
You must be signed in to change notification settings - Fork 203
cp exec util from kubernetes/kubernetes #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…hey're in $PATH on all.
Use %v for errors, tidy some messages, make error messages start lowe-case (as per go guidelines). Just accumulated nits.
Instead of saying "Google Inc." (which is not always correct) say "The Kubernetes Authors", which is generic.
Auto commit by PR queue bot
Also add Output() to the util/exec Cmd interface.
- improve restoreInternal implementation in iptables - add SetStdin and SetStdout functions to Cmd interface - modify kubelet/prober and some tests in order to work with Cmd interface
Add canonical imports only in existing doc.go files. https://golang.org/doc/go1.4#canonicalimports Fixes #29014
Automatic merge from submit-queue improve iptables-restore implementation #27559 []() fixes #27559 - improve restoreInternal implementation in iptables - add SetStdin and SetStdout functions to Cmd interface - modify kubelet/prober and some tests in order to work with Cmd interface
`ex.Command()` already searches the binary in PATH, no need to manually specify it. `pkg/util/exec` tests fail in non-conventional environments due to this (e.g. NixOS).
Travis finally works. |
exec/doc.go
Outdated
@@ -0,0 +1,18 @@ | |||
/* | |||
Copyright 201i7 The Kubernetes Authors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you make that typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be able to verify license in files :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use this file in k/k: https://github.com/kubernetes/kubernetes/blob/master/hack/verify-boilerplate.sh
@spxtr any clue? |
The CLA won't pass since this includes commits made before we switched to CNCF CLA. That's fine, merge over it. |
Not sure why travis isn't responding. |
It's running! |
Yay, now we know it's broken ;-) |
It was broken because I move |
We need to wait till this PR get merged first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Mengqi!
exec/testing/fake_exec.go
Outdated
limitations under the License. | ||
*/ | ||
|
||
package exec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be named package exec even though it's actually in exec/testing/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to testingexec
.
|
||
// Wraps exec.Cmd so we can capture errors. | ||
type cmdWrapper osexec.Cmd | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to add
var _ Cmd = &cmdWrapper{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. It's good to have a check to make sure it has implemented the interface.
Also add the check in testing/fake_exec.go
. Does it make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think it does. I didn't mention it because func InitFakeCmd(fake *FakeCmd, cmd string, args ...string) exec.Cmd
would fail if fake
wasn't a exec.Cmd
, but that's probably more subtle that necessary. Thanks for the changes!
exec/exec.go
Outdated
// ErrExecutableNotFound is returned if the executable is not found. | ||
var ErrExecutableNotFound = osexec.ErrNotFound | ||
|
||
// Interface is an interface that presents a subset of the os/exec API. Use this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very dumb nit: double space after period
exec/exec.go
Outdated
} | ||
|
||
// Cmd is an interface that presents an API that is very similar to Cmd from os/exec. | ||
// As more functionality is needed, this can grow. Since Cmd is a struct, we will have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very dumb nit: double space after period
exec/exec.go
Outdated
// Run runs the command to the completion. | ||
Run() error | ||
// CombinedOutput runs the command and returns its combined standard output | ||
// and standard error. This follows the pattern of package os/exec. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very dumb nit: double space after period
exec/exec.go
Outdated
} | ||
|
||
// ExitError is an interface that presents an API similar to os.ProcessState, which is | ||
// what ExitError from os/exec is. This is designed to make testing a bit easier and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very dumb nit: double space after period
@apelisse PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
|
||
// Wraps exec.Cmd so we can capture errors. | ||
type cmdWrapper osexec.Cmd | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think it does. I didn't mention it because func InitFakeCmd(fake *FakeCmd, cmd string, args ...string) exec.Cmd
would fail if fake
wasn't a exec.Cmd
, but that's probably more subtle that necessary. Thanks for the changes!
Forced the merge because of cla errors. |
Associated PR against main repo: kubernetes/kubernetes#49234 |
Automatic merge from submit-queue (batch tested with PRs 49107, 47177, 49234, 49224, 49227) Move util/exec to vendor Move util/exec to vendor. Update import paths. Update godep Part of #48209 Associate PR against `k8s.io/utils` repo: kubernetes/utils#5 ```release-note NONE ``` /assign @apelisse
Automatic merge from submit-queue (batch tested with PRs 49107, 47177, 49234, 49224, 49227) Move util/exec to vendor Move util/exec to vendor. Update import paths. Update godep Part of #48209 Associate PR against `k8s.io/utils` repo: kubernetes/utils#5 ```release-note NONE ``` /assign @apelisse
Automatic merge from submit-queue (batch tested with PRs 49107, 47177, 49234, 49224, 49227) Move util/exec to vendor Move util/exec to vendor. Update import paths. Update godep Part of #48209 Associate PR against `k8s.io/utils` repo: kubernetes/utils#5 ```release-note NONE ``` /assign @apelisse
Automatic merge from submit-queue (batch tested with PRs 49107, 47177, 49234, 49224, 49227) Move util/exec to vendor Move util/exec to vendor. Update import paths. Update godep Part of #48209 Associate PR against `k8s.io/utils` repo: kubernetes#5 ```release-note NONE ``` /assign @apelisse
No description provided.