mirror of
https://github.com/rancher/rke.git
synced 2025-04-28 11:36:27 +00:00
Remove uneeded nil check
This commit is contained in:
parent
9a03d8020b
commit
8022b815b3
@ -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 {
|
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)
|
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!
|
// start the download server, only one node should have it!
|
||||||
if err := services.StartBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath); err != nil {
|
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)
|
log.Warnf(ctx, "failed to start backup server on host [%s]: %v", host.Address, err)
|
||||||
errors = append(errors, err)
|
errors = append(errors, err)
|
||||||
continue
|
continue
|
||||||
}
|
|
||||||
backupServer = host
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
backupServer = host
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if backupServer == nil { //failed to start the backupServer, I will cleanup and exit
|
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
|
// start downloading the snapshot
|
||||||
for _, host := range c.EtcdHosts {
|
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
|
continue
|
||||||
}
|
}
|
||||||
if err := services.DownloadEtcdSnapshotFromBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath, backupServer); err != nil {
|
if err := services.DownloadEtcdSnapshotFromBackupServer(ctx, host, c.PrivateRegistriesMap, backupImage, snapshotPath, backupServer); err != nil {
|
||||||
|
@ -140,8 +140,5 @@ func getEtcdTLSConfig(certificate, key []byte) (*tls.Config, error) {
|
|||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
Certificates: []tls.Certificate{x509Pair},
|
Certificates: []tls.Certificate{x509Pair},
|
||||||
}
|
}
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return tlsConfig, nil
|
return tlsConfig, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user