mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 15:47:14 +01:00
capi system: clean up etcd dir
Etcd data is preserved to support the standalone openshift-install destroy bootstrap command. We can only delete this once bootstrap destroy has been completed. Teardown may be called in other cases, such as an error or user interrupt, so this commit introduces a separate function to delete the etcd directoy specifically.
This commit is contained in:
@@ -59,6 +59,7 @@ type Interface interface {
|
||||
State() SystemState
|
||||
Client() client.Client
|
||||
Teardown()
|
||||
CleanEtcd()
|
||||
}
|
||||
|
||||
// System returns the cluster-api system.
|
||||
@@ -393,6 +394,21 @@ func (c *system) Teardown() {
|
||||
})
|
||||
}
|
||||
|
||||
// CleanEtcd removes the etcd database from the host.
|
||||
func (c *system) CleanEtcd() {
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
|
||||
if c.lcp == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Clean up the etcd directory.
|
||||
if err := os.RemoveAll(c.lcp.EtcdDataDir); err != nil {
|
||||
logrus.Warnf("Unable to delete local etcd data directory %s. It is safe to remove the directory manually", c.lcp.EtcdDataDir)
|
||||
}
|
||||
}
|
||||
|
||||
// State returns the state of the cluster-api system.
|
||||
func (c *system) State() SystemState {
|
||||
c.Lock()
|
||||
|
||||
Reference in New Issue
Block a user