@@ -164,15 +164,12 @@ func prepareConfigSwtichRegion(cmd *cobra.Command) error {
164164}
165165
166166func prepareCommand (cmd * cobra.Command ) error {
167- err := UpgradeConfigFile ()
168- if err != nil {
169- return err
170- }
167+ _ = UpgradeConfigFile ()
171168
172169 arvanConfig := config .GetConfigInfo ()
173170 kubeConfigPath := paasConfigPath ()
174171
175- err = setConfigFlag (cmd , kubeConfigPath )
172+ err : = setConfigFlag (cmd , kubeConfigPath )
176173 if err != nil {
177174 return err
178175 }
@@ -194,12 +191,12 @@ func UpgradeConfigFile() error {
194191 if err != nil {
195192 return err
196193 }
197- if strings . Contains ( configFileStruct . Clusters [ 0 ]. Cluster . Server , "arvancloud.com" ) {
198- configFileStruct .Clusters [0 ].Cluster .Server = strings .Replace (configFileStruct .Clusters [0 ].Cluster .Server , "arvancloud.com" , "arvancloud.ir" , - 1 )
199- }
194+
195+ configFileStruct .Clusters [0 ].Cluster .Server = strings .Replace (configFileStruct .Clusters [0 ].Cluster .Server , "arvancloud.com" , "arvancloud.ir" , - 1 )
196+
200197 err = writeKubeConfig (configFileStruct , path )
201198 if err != nil {
202- return err
199+ return err
203200 }
204201
205202 return nil
@@ -261,7 +258,7 @@ func whoAmI() (string, int, error) {
261258 return "" , httpResp .StatusCode , err
262259 }
263260 if kind != "User" {
264- return "" , httpResp .StatusCode , errors .New ("User kind not supported" )
261+ return "" , httpResp .StatusCode , errors .New ("user kind not supported" )
265262 }
266263 var metadata map [string ]* json.RawMessage
267264 err = json .Unmarshal (* objmap ["metadata" ], & metadata )
@@ -278,7 +275,7 @@ func whoAmI() (string, int, error) {
278275 }
279276 }
280277
281- return "" , httpResp .StatusCode , errors .New ("invalid authentication credentials. " )
278+ return "" , httpResp .StatusCode , errors .New ("invalid authentication credentials" )
282279}
283280
284281func projectList () ([]string , error ) {
@@ -321,15 +318,15 @@ func projectList() ([]string, error) {
321318 for i := 0 ; i < len (projects ); i ++ {
322319 err = json .Unmarshal (* projects [i ], & project )
323320 if err != nil || project ["metadata" ] == nil {
324- return nil , errors .New ("Invalid projects response" )
321+ return nil , errors .New ("invalid projects response" )
325322 }
326323 err = json .Unmarshal (* project ["metadata" ], & projectMetadata )
327324 if err != nil || projectMetadata ["name" ] == nil {
328- return nil , errors .New ("Invalid projects response" )
325+ return nil , errors .New ("invalid projects response" )
329326 }
330327 err = json .Unmarshal (* projectMetadata ["name" ], & projectName )
331328 if err != nil || projectMetadata ["name" ] == nil {
332- return nil , errors .New ("Invalid projects response" )
329+ return nil , errors .New ("invalid projects response" )
333330 }
334331 result = append (result , projectName )
335332 }
@@ -338,7 +335,7 @@ func projectList() ([]string, error) {
338335 return nil , nil
339336 }
340337 }
341- return nil , errors .New ("Invalid projects response" )
338+ return nil , errors .New ("invalid projects response" )
342339}
343340
344341func getArvanAuthorization () string {
0 commit comments