Skip to content

Commit 8374fb2

Browse files
author
OpenShift Bot
committed
Merge pull request #3548 from mnagy/dont_warn_on_output
Merged by openshift-bot
2 parents 1be3771 + b1dc6f2 commit 8374fb2

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

pkg/cmd/cli/cmd/newapp.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func RunNewApplication(fullName string, f *clientcmd.Factory, out io.Writer, c *
122122
return err
123123
}
124124

125-
result, err := config.RunAll(out)
125+
result, err := config.RunAll(out, c.Out())
126126
if err != nil {
127127
if errs, ok := err.(errors.Aggregate); ok {
128128
if len(errs.Errors()) == 1 {

pkg/cmd/cli/cmd/newbuild.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func RunNewBuild(fullName string, f *clientcmd.Factory, out io.Writer, c *cobra.
7575
return err
7676
}
7777

78-
result, err := config.RunBuilds(out)
78+
result, err := config.RunBuilds(out, c.Out())
7979
if err != nil {
8080
if errs, ok := err.(errors.Aggregate); ok {
8181
if len(errs.Errors()) == 1 {

pkg/generate/app/cmd/newapp.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -523,14 +523,14 @@ type AppResult struct {
523523
}
524524

525525
// RunAll executes the provided config to generate all objects.
526-
func (c *AppConfig) RunAll(out io.Writer) (*AppResult, error) {
527-
return c.run(out, app.Acceptors{app.NewAcceptUnique(c.typer), app.AcceptNew})
526+
func (c *AppConfig) RunAll(out, errOut io.Writer) (*AppResult, error) {
527+
return c.run(out, errOut, app.Acceptors{app.NewAcceptUnique(c.typer), app.AcceptNew})
528528
}
529529

530530
// RunBuilds executes the provided config to generate just builds.
531-
func (c *AppConfig) RunBuilds(out io.Writer) (*AppResult, error) {
531+
func (c *AppConfig) RunBuilds(out, errOut io.Writer) (*AppResult, error) {
532532
bcAcceptor := app.NewAcceptBuildConfigs(c.typer)
533-
result, err := c.run(out, app.Acceptors{bcAcceptor, app.NewAcceptUnique(c.typer), app.AcceptNew})
533+
result, err := c.run(out, errOut, app.Acceptors{bcAcceptor, app.NewAcceptUnique(c.typer), app.AcceptNew})
534534
if err != nil {
535535
return nil, err
536536
}
@@ -586,7 +586,7 @@ func makeImageStreamKey(ref kapi.ObjectReference) string {
586586
}
587587

588588
// run executes the provided config applying provided acceptors.
589-
func (c *AppConfig) run(out io.Writer, acceptors app.Acceptors) (*AppResult, error) {
589+
func (c *AppConfig) run(out, errOut io.Writer, acceptors app.Acceptors) (*AppResult, error) {
590590
c.ensureDockerResolver()
591591
repositories, err := c.individualSourceRepositories()
592592
if err != nil {
@@ -641,7 +641,7 @@ func (c *AppConfig) run(out io.Writer, acceptors app.Acceptors) (*AppResult, err
641641
}
642642
if p.Image != nil && p.Image.HasEmptyDir {
643643
if _, ok := warned[p.Image.Name]; !ok {
644-
fmt.Fprintf(out, "NOTICE: Image %q uses an EmptyDir volume. Data in EmptyDir volumes is not persisted across deployments.\n", p.Image.Name)
644+
fmt.Fprintf(errOut, "NOTICE: Image %q uses an EmptyDir volume. Data in EmptyDir volumes is not persisted across deployments.\n", p.Image.Name)
645645
warned[p.Image.Name] = struct{}{}
646646
}
647647
}

pkg/generate/app/cmd/newapp_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ func TestRunAll(t *testing.T) {
681681

682682
for _, test := range tests {
683683
test.config.refBuilder = &app.ReferenceBuilder{}
684-
res, err := test.config.RunAll(os.Stdout)
684+
res, err := test.config.RunAll(os.Stdout, os.Stderr)
685685
if err != test.expectedErr {
686686
t.Errorf("%s: Error mismatch! Expected %v, got %v", test.name, test.expectedErr, err)
687687
continue
@@ -830,7 +830,7 @@ func TestRunBuild(t *testing.T) {
830830

831831
for _, test := range tests {
832832
test.config.refBuilder = &app.ReferenceBuilder{}
833-
res, err := test.config.RunBuilds(os.Stdout)
833+
res, err := test.config.RunBuilds(os.Stdout, os.Stderr)
834834
if err != test.expectedErr {
835835
t.Errorf("%s: Error mismatch! Expected %v, got %v", test.name, test.expectedErr, err)
836836
continue

0 commit comments

Comments
 (0)