Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrage committed Jul 21, 2022
1 parent 92d4c63 commit 7e1e631
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions pkg/odo/cli/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@ func (o *DeployOptions) Complete(cmdline cmdline.Cmdline, args []string) (err er
if err != nil {
return fmt.Errorf("failed to write new env.yaml file: %w", err)
}
}

// If the env.yaml exists and the project is set incorrectly, we'll override it.
if envfileinfo.Exists() && envfileinfo.GetComponentSettings().Project != o.GetProject() {
} else if envfileinfo.Exists() && envfileinfo.GetComponentSettings().Project != o.GetProject() {
// If the env.yaml exists and the project is set incorrectly, we'll override it.
klog.V(4).Info("Overriding project name in env.yaml as it's set incorrectly, new project name: ", o.GetProject())
err = envfileinfo.SetConfiguration("project", o.GetProject())
if err != nil {
Expand Down
8 changes: 3 additions & 5 deletions pkg/odo/cli/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,13 @@ func (o *DevOptions) Complete(cmdline cmdline.Cmdline, args []string) error {

// If the env.yaml does not exist, we will save the project name
if !envfileinfo.Exists() {
klog.V(4).Info("Overriding project name in env.yaml as it's set incorrectly, new project name: ", o.GetProject())
err = envfileinfo.SetComponentSettings(envinfo.ComponentSettings{Project: o.GetProject()})
if err != nil {
return fmt.Errorf("failed to write new env.yaml file: %w", err)
}
}

// If the env.yaml exists and the project is set incorrectly, we'll override it.
if envfileinfo.Exists() && envfileinfo.GetComponentSettings().Project != o.GetProject() {
} else if envfileinfo.Exists() && envfileinfo.GetComponentSettings().Project != o.GetProject() {
// If the env.yaml exists and the project is set incorrectly, we'll override it.
klog.V(4).Info("Overriding project name in env.yaml as it's set incorrectly, new project name: ", o.GetProject())
err = envfileinfo.SetConfiguration("project", o.GetProject())
if err != nil {
return fmt.Errorf("failed to update project in env.yaml file: %w", err)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cmd_dev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ var _ = Describe("odo dev command tests", func() {

// Returned pvc yaml contains ownerreference
By("creating a pvc with ownerreference", func() {
output := commonVar.CliRunner.Run("get", "pvc", "--namespace", commonVar.Project, "-o", `jsonpath='{range .items[*].metadata.ownerReferences[*]}{@..kind}{"/"}{@..name}{end}'`).Out.Contents()
output := commonVar.CliRunner.Run("get", "pvc", "--namespace", commonVar.Project, "-o", `jsonpath='{range .items[*].metadata.ownerReferences[*]}{@..kind}{"/"}{@..name}{"\n"}{end}'`).Out.Contents()
Expect(string(output)).To(ContainSubstring(fmt.Sprintf("Deployment/%s-app", cmpName)))
})
})
Expand Down

0 comments on commit 7e1e631

Please sign in to comment.