Merge pull request #69742 from apelisse/fix-diff-error

Rename KUBERNETES_EXTERNAL_DIFF to KUBECTL_EXTERNAL_DIFF
This commit is contained in:
k8s-ci-robot
2018-10-13 09:54:52 -07:00
committed by GitHub
3 changed files with 8 additions and 12 deletions

View File

@@ -49,7 +49,7 @@ var (
Output is always YAML.
KUBERNETES_EXTERNAL_DIFF environment variable can be used to select your own
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own
diff command. By default, the "diff" command available in your path will be
run with "-u" (unicode) and "-N" (treat new files as empty) options.`))
diffExample = templates.Examples(i18n.T(`
@@ -97,7 +97,7 @@ func NewCmdDiff(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
}
// DiffProgram finds and run the diff program. The value of
// KUBERNETES_EXTERNAL_DIFF environment variable will be used a diff
// KUBECTL_EXTERNAL_DIFF environment variable will be used a diff
// program. By default, `diff(1)` will be used.
type DiffProgram struct {
Exec exec.Interface
@@ -106,7 +106,7 @@ type DiffProgram struct {
func (d *DiffProgram) getCommand(args ...string) exec.Cmd {
diff := ""
if envDiff := os.Getenv("KUBERNETES_EXTERNAL_DIFF"); envDiff != "" {
if envDiff := os.Getenv("KUBECTL_EXTERNAL_DIFF"); envDiff != "" {
diff = envDiff
} else {
diff = "diff"
@@ -122,8 +122,7 @@ func (d *DiffProgram) getCommand(args ...string) exec.Cmd {
// Run runs the detected diff program. `from` and `to` are the directory to diff.
func (d *DiffProgram) Run(from, to string) error {
d.getCommand(from, to).Run() // Ignore diff return code
return nil
return d.getCommand(from, to).Run()
}
// Printer is used to print an object.
@@ -397,8 +396,5 @@ func RunDiff(f cmdutil.Factory, diff *DiffProgram, options *DiffOptions) error {
return err
}
// Error ignore on purpose. diff(1) for example, returns an error if there is any diff.
_ = differ.Run(diff)
return nil
return differ.Run(diff)
}