Browse code

make the new-project cli display the correct message on denial

deads2k authored on 2015/05/02 04:30:32
Showing 1 changed files
... ...
@@ -7,7 +7,9 @@ import (
7 7
 
8 8
 	"github.com/spf13/cobra"
9 9
 
10
+	"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
10 11
 	kcmdutil "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
12
+	"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
11 13
 
12 14
 	"github.com/openshift/origin/pkg/client"
13 15
 	cliconfig "github.com/openshift/origin/pkg/cmd/cli/config"
... ...
@@ -93,6 +95,12 @@ func (o *NewProjectOptions) complete(cmd *cobra.Command, f *clientcmd.Factory) e
93 93
 }
94 94
 
95 95
 func (o *NewProjectOptions) Run() error {
96
+	// TODO eliminate this when we get better forbidden messages
97
+	_, err := o.Client.ProjectRequests().List(labels.Everything(), fields.Everything())
98
+	if err != nil {
99
+		return err
100
+	}
101
+
96 102
 	projectRequest := &projectapi.ProjectRequest{}
97 103
 	projectRequest.Name = o.ProjectName
98 104
 	projectRequest.DisplayName = o.DisplayName