Skip to content

Commit

Permalink
Fix errors when ucp/engine is missing during reset (#108)
Browse files Browse the repository at this point in the history
Signed-off-by: Jari Kolehmainen <[email protected]>
  • Loading branch information
jakolehm authored May 28, 2020
1 parent 6fcf3d8 commit 19f0c51
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/phase/uninstall_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ func (p *UninstallEngine) Run(c *api.ClusterConfig) error {
}

func (p *UninstallEngine) uninstallEngine(host *api.Host, c *api.ClusterConfig) error {
err := host.Exec(host.Configurer.DockerCommandf("info"))
if err != nil {
log.Infof("%s: engine not installed, skipping", host.Address)
return nil
}
log.Infof("%s: uninstalling engine", host.Address)
err := host.Configurer.UninstallEngine(&c.Spec.Engine)
err = host.Configurer.UninstallEngine(&c.Spec.Engine)
if err == nil {
log.Infof("%s: engine uninstalled", host.Address)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/phase/uninstall_ucp.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

api "github.com/Mirantis/mcc/pkg/apis/v1beta1"
"github.com/Mirantis/mcc/pkg/swarm"
log "github.com/sirupsen/logrus"
)

// UninstallUCP is the phase implementation for running UCP uninstall
Expand All @@ -20,6 +21,10 @@ func (p *UninstallUCP) Title() string {
// Run the installer container
func (p *UninstallUCP) Run(config *api.ClusterConfig) error {
swarmLeader := config.Spec.SwarmLeader()
if !config.Spec.Ucp.Metadata.Installed {
log.Infof("%s: UCP is not installed, skipping", swarmLeader.Address)
return nil
}

image := fmt.Sprintf("%s/ucp:%s", config.Spec.Ucp.ImageRepo, config.Spec.Ucp.Version)
args := fmt.Sprintf("--id %s", swarm.ClusterID(swarmLeader))
Expand Down

0 comments on commit 19f0c51

Please sign in to comment.