1
0
mirror of https://github.com/rancher/rke.git synced 2025-04-27 19:25:44 +00:00

Remove uneeded nil check

This commit is contained in:
Dax McDonald 2019-09-20 16:54:44 -07:00 committed by Alena Prokharchyk
parent 9a03d8020b
commit 8022b815b3
2 changed files with 8 additions and 12 deletions

View File

@ -68,15 +68,14 @@ func (c *Cluster) PrepareBackup(ctx context.Context, snapshotPath string) error
if err := docker.StopContainer(ctx, host.DClient, host.Address, services.EtcdContainerName); err != nil {
log.Warnf(ctx, "failed to stop etcd container on host [%s]: %v", host.Address, err)
}
if backupServer == nil { // start the download server, only one node should have it!
if err := services.StartBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath); err != nil {
log.Warnf(ctx, "failed to start backup server on host [%s]: %v", host.Address, err)
errors = append(errors, err)
continue
}
backupServer = host
break
// start the download server, only one node should have it!
if err := services.StartBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath); err != nil {
log.Warnf(ctx, "failed to start backup server on host [%s]: %v", host.Address, err)
errors = append(errors, err)
continue
}
backupServer = host
break
}
if backupServer == nil { //failed to start the backupServer, I will cleanup and exit
@ -89,7 +88,7 @@ func (c *Cluster) PrepareBackup(ctx context.Context, snapshotPath string) error
}
// start downloading the snapshot
for _, host := range c.EtcdHosts {
if backupServer != nil && host.Address == backupServer.Address { // we skip the backup server if it's there
if host.Address == backupServer.Address { // we skip the backup server if it's there
continue
}
if err := services.DownloadEtcdSnapshotFromBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath, backupServer); err != nil {

View File

@ -140,8 +140,5 @@ func getEtcdTLSConfig(certificate, key []byte) (*tls.Config, error) {
InsecureSkipVerify: true,
Certificates: []tls.Certificate{x509Pair},
}
if err != nil {
return nil, err
}
return tlsConfig, nil
}