Skip to content

Commit 24253c8

Browse files
author
OpenShift Bot
committed
Merge pull request #5438 from fabianofranz/issues_5059
Merged by openshift-bot
2 parents ba552b0 + 190d64b commit 24253c8

File tree

10 files changed

+42
-14
lines changed

10 files changed

+42
-14
lines changed

pkg/cmd/cli/cmd/cancelbuild.go

+16
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func NewCmdCancelBuild(fullName string, f *clientcmd.Factory, out io.Writer) *co
4747

4848
cmd.Flags().Bool("dump-logs", false, "Specify if the build logs for the cancelled build should be shown.")
4949
cmd.Flags().Bool("restart", false, "Specify if a new build should be created after the current build is cancelled.")
50+
//cmdutil.AddOutputFlagsForMutation(cmd)
5051
return cmd
5152
}
5253

@@ -107,6 +108,10 @@ func RunCancelBuild(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, arg
107108
}
108109
glog.V(2).Infof("Build %s was cancelled.", buildName)
109110

111+
// mapper, typer := f.Object()
112+
// resourceMapper := &resource.Mapper{ObjectTyper: typer, RESTMapper: mapper, ClientMapper: f.ClientMapperForCommand()}
113+
// shortOutput := cmdutil.GetFlagString(cmd, "output") == "name"
114+
110115
// Create a new build with the same configuration.
111116
if cmdutil.GetFlagBool(cmd, "restart") {
112117
request := &buildapi.BuildRequest{
@@ -118,8 +123,19 @@ func RunCancelBuild(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, arg
118123
}
119124
glog.V(2).Infof("Restarted build %s.", buildName)
120125
fmt.Fprintf(out, "%s\n", newBuild.Name)
126+
// fmt.Fprintf(out, "%s\n", newBuild.Name)
127+
// info, err := resourceMapper.InfoForObject(newBuild)
128+
// if err != nil {
129+
// return err
130+
// }
131+
//cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "restarted")
121132
} else {
122133
fmt.Fprintf(out, "%s\n", build.Name)
134+
// info, err := resourceMapper.InfoForObject(build)
135+
// if err != nil {
136+
// return err
137+
// }
138+
// cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "cancelled")
123139
}
124140
return nil
125141
}

pkg/cmd/cli/cmd/env.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ func RunEnv(f *clientcmd.Factory, in io.Reader, out io.Writer, cmd *cobra.Comman
303303
continue
304304
}
305305
info.Refresh(obj, true)
306-
fmt.Fprintf(out, "%s/%s\n", info.Mapping.Resource, info.Name)
306+
307+
shortOutput := cmdutil.GetFlagString(cmd, "output") == "name"
308+
cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "updated")
307309
}
308310
if failed {
309311
return errExit

pkg/cmd/cli/cmd/process.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewCmdProcess(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.
6767
cmd.Flags().BoolP("parameters", "", false, "Do not process but only print available parameters")
6868
cmd.Flags().StringP("labels", "l", "", "Label to set in all resources for this template")
6969

70-
cmd.Flags().StringP("output", "o", "json", "Output format. One of: describe|json|yaml|template|templatefile.")
70+
cmd.Flags().StringP("output", "o", "json", "Output format. One of: describe|json|yaml|name|template|templatefile.")
7171
cmd.Flags().Bool("raw", false, "If true output the processed template instead of the template's objects. Implied by -o describe")
7272
cmd.Flags().String("output-version", "", "Output the formatted object with the given version (default api-version).")
7373
cmd.Flags().StringP("template", "t", "", "Template string or path to template file to use when -o=template or -o=templatefile. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview]")

pkg/cmd/cli/cmd/rollback.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func NewCmdRollback(fullName string, f *clientcmd.Factory, out io.Writer) *cobra
8585
cmd.Flags().BoolVar(&opts.IncludeStrategy, "change-strategy", false, "Include the previous deployment's strategy in the rollback")
8686
cmd.Flags().BoolVar(&opts.IncludeScalingSettings, "change-scaling-settings", false, "Include the previous deployment's replicationController replica count and selector in the rollback")
8787
cmd.Flags().BoolVarP(&opts.DryRun, "dry-run", "d", false, "Instead of performing the rollback, describe what the rollback will look like in human-readable form")
88-
cmd.Flags().StringVarP(&opts.Format, "output", "o", "", "Instead of performing the rollback, print the updated deployment configuration in the specified format (json|yaml|template|templatefile)")
88+
cmd.Flags().StringVarP(&opts.Format, "output", "o", "", "Instead of performing the rollback, print the updated deployment configuration in the specified format (json|yaml|name|template|templatefile)")
8989
cmd.Flags().StringVarP(&opts.Template, "template", "t", "", "Template string or path to template file to use when -o=template or -o=templatefile.")
9090
cmd.Flags().IntVar(&opts.DesiredVersion, "to-version", 0, "A config version to rollback to. Specifying version 0 is the same as omitting a version (the version will be auto-detected). This option is ignored when specifying a deployment.")
9191

pkg/cmd/cli/cmd/startbuild.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ func NewCmdStartBuild(fullName string, f *clientcmd.Factory, in io.Reader, out i
100100

101101
cmd.Flags().String("git-post-receive", "", "The contents of the post-receive hook to trigger a build")
102102
cmd.Flags().String("git-repository", "", "The path to the git repository for post-receive; defaults to the current directory")
103+
104+
// cmdutil.AddOutputFlagsForMutation(cmd)
103105
return cmd
104106
}
105107

@@ -113,9 +115,6 @@ func RunStartBuild(f *clientcmd.Factory, in io.Reader, out io.Writer, cmd *cobra
113115
fromFile := cmdutil.GetFlagString(cmd, "from-file")
114116
fromDir := cmdutil.GetFlagString(cmd, "from-dir")
115117
fromRepo := cmdutil.GetFlagString(cmd, "from-repo")
116-
//shortOutput := false
117-
118-
//mapper, _ := f.Object()
119118

120119
switch {
121120
case len(webhook) > 0:
@@ -190,8 +189,15 @@ func RunStartBuild(f *clientcmd.Factory, in io.Reader, out io.Writer, cmd *cobra
190189
}
191190
}
192191

193-
//cmdutil.PrintSuccess(mapper, shortOutput, out, "Build", newBuild.Name, "started")
194192
fmt.Fprintln(out, newBuild.Name)
193+
// mapper, typer := f.Object()
194+
// resourceMapper := &resource.Mapper{ObjectTyper: typer, RESTMapper: mapper, ClientMapper: f.ClientMapperForCommand()}
195+
// info, err := resourceMapper.InfoForObject(newBuild)
196+
// if err != nil {
197+
// return err
198+
// }
199+
// shortOutput := cmdutil.GetFlagString(cmd, "output") == "name"
200+
// cmdutil.PrintSuccess(mapper, shortOutput, out, info.Mapping.Resource, info.Name, "started")
195201

196202
var (
197203
wg sync.WaitGroup

pkg/config/cmd/cmd.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ type Bulk struct {
2323
func NewPrintNameOrErrorAfter(mapper meta.RESTMapper, short bool, operation string, out, errs io.Writer) func(*resource.Info, error) {
2424
return func(info *resource.Info, err error) {
2525
if err == nil {
26-
cmdutil.PrintSuccess(mapper, false, out, info.Mapping.Kind, info.Name, operation)
26+
//cmdutil.PrintSuccess(mapper, short, out, info.Mapping.Resource, info.Name, operation)
27+
cmdutil.PrintSuccess(mapper, short, out, info.Mapping.Kind, info.Name, operation)
2728
} else {
2829
fmt.Fprintf(errs, "error: %v\n", err)
2930
}

test/cmd/basicresources.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ oc get secret json-with-extension yml-with-extension
2424
echo "resource-builder: ok"
2525

2626
oc get pods --match-server-version
27-
oc create -f examples/hello-openshift/hello-pod.json
27+
[ "$(oc create -f examples/hello-openshift/hello-pod.json 2>&1 | grep 'pod "hello-openshift" created')" ]
2828
oc describe pod hello-openshift
2929
oc delete pods hello-openshift
3030
echo "pods: ok"
3131

32-
oc create -f examples/hello-openshift/hello-pod.json
32+
[ "$(oc create -f examples/hello-openshift/hello-pod.json -o name 2>&1 | grep 'pod/hello-openshift')" ]
3333
tryuntil oc label pod/hello-openshift acustom=label # can race against scheduling and status updates
3434
[ "$(oc describe pod/hello-openshift | grep 'acustom=label')" ]
3535
tryuntil oc annotate pod/hello-openshift foo=bar # can race against scheduling and status updates

test/cmd/builds.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ echo "start-build: ok"
5555
oc cancel-build "${started}" --dump-logs --restart
5656
echo "cancel-build: ok"
5757

58-
oc delete is/ruby-20-centos7-buildcli
59-
oc delete bc/ruby-sample-build-validtag
60-
oc delete bc/ruby-sample-build-invalidtag
58+
[ "$(oc delete is/ruby-20-centos7-buildcli | grep 'imagestream "ruby-20-centos7-buildcli" deleted')" ]
59+
[ "$(oc delete bc/ruby-sample-build-validtag -o name | grep 'buildconfig/ruby-sample-build-validtag')" ]
60+
[ "$(oc delete bc/ruby-sample-build-invalidtag | grep 'buildconfig "ruby-sample-build-invalidtag" deleted')" ]

test/cmd/deployments.sh

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ oc get deploymentConfigs
1414
oc get dc
1515
oc create -f test/integration/fixtures/test-deployment-config.json
1616
oc describe deploymentConfigs test-deployment-config
17+
[ "$(oc get dc -o name | grep 'deploymentconfig/test-deployment-config')" ]
1718
[ "$(oc describe dc test-deployment-config | grep 'deploymentconfig=test-deployment-config')" ]
1819
[ "$(oc env dc/test-deployment-config --list | grep TEST=value)" ]
1920
[ ! "$(oc env dc/test-deployment-config TEST- --list | grep TEST=value)" ]

test/cmd/newapp.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ oc get template ruby-helloworld-sample
7272
[ "$(oc new-app --search mysql --param=FOO=BAR 2>&1 | grep "can't be used")" ]
7373
oc delete imageStreams --all
7474
# check that we can create from the template without errors
75-
oc new-app ruby-helloworld-sample -l app=helloworld
75+
[ "$(oc new-app ruby-helloworld-sample -l app=helloworld 2>&1 | grep 'Service "frontend" created')" ]
76+
oc delete all -l app=helloworld
77+
[ "$(oc new-app ruby-helloworld-sample -l app=helloworld -o name 2>&1 | grep 'Service/frontend')" ]
7678
oc delete all -l app=helloworld
7779
# create from template with code explicitly set is not supported
7880
[ ! "$(oc new-app [email protected]/mfojtik/sinatra-app-example)" ]

0 commit comments

Comments
 (0)