Skip to content

Commit

Permalink
Merge pull request #319 from malinthaprasan/3.1.x
Browse files Browse the repository at this point in the history
Fix main-config.yaml not found during init
  • Loading branch information
npamudika authored May 27, 2020
2 parents 00c2d35 + a9145c9 commit 84aef1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions import-export-cli/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
// Delete command related usage Info
const deleteCmdLiteral = "delete"
const deleteCmdShortDesc = "Delete an API/Application in an environment"
const deleteCmdLongDesc = `Delete an API available in the environment specified by flag (--environment, -e) in default mode/
Delete an Application of a specific user in the environment specified by flag (--environment, -e) in default mode/
const deleteCmdLongDesc = `Delete an API available in the environment specified by flag (--environment, -e) in default mode
Delete an Application of a specific user in the environment specified by flag (--environment, -e) in default mode
Delete resources by filenames, stdin, resources and names, or by resources and label selector in kubernetes mode`

const deleteCmdExamples = utils.ProjectName + ` ` + deleteCmdLiteral + ` ` + deleteAPICmdLiteral + ` -n TwitterAPI -v 1.0.0 -r admin -e dev
Expand Down
7 changes: 5 additions & 2 deletions import-export-cli/cmd/deleteAPI.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,11 @@ func init() {
"Provider of the API to be deleted")
DeleteAPICmd.Flags().StringVarP(&deleteAPIEnvironment, "environment", "e",
"", "Environment from which the API should be deleted")
configVars := utils.GetMainConfigFromFile(utils.MainConfigFilePath)
if !configVars.Config.KubernetesMode {

// fetches the main-config.yaml file silently; i.e. if it's not created, ignore the error and assume that
// this is the default mode.
configVars := utils.GetMainConfigFromFileSilently(utils.MainConfigFilePath)
if configVars == nil || !configVars.Config.KubernetesMode {
// Mark required flags
_ = DeleteAPICmd.MarkFlagRequired("name")
_ = DeleteAPICmd.MarkFlagRequired("version")
Expand Down

0 comments on commit 84aef1b

Please sign in to comment.