Skip to content

Commit

Permalink
Use reusable command executor to get failure message
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredoconnell committed Sep 27, 2024
1 parent 4290a5a commit 04c3c73
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions internal/cliwrapper/cliwrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,15 @@ func (p *cliWrapper) Deploy(image string, podmanArgs []string, containerArgs []s
}

func (p *cliWrapper) KillAndClean(containerName string) error {
cmdKill := p.getPodmanCmd("kill", containerName)
p.logger.Debugf("Killing with command %v", cmdKill.Args)
if err := cmdKill.Run(); err != nil {
p.logger.Warningf("failed to kill pod %s; it may have exited earlier", containerName)
_, err := p.runPodmanCmd("killing container "+containerName, "kill", containerName)
if err != nil {
p.logger.Warningf("failed to kill pod %s (%s); it may have exited earlier", containerName, err.Error())
} else {
p.logger.Debugf("successfully killed container %s", containerName)
}

msg := "removing container " + containerName
_, err := p.runPodmanCmd(msg, "rm", "--force", containerName)
_, err = p.runPodmanCmd(msg, "rm", "--force", containerName)
if err != nil {
p.logger.Errorf(err.Error())
} else {
Expand Down

0 comments on commit 04c3c73

Please sign in to comment.