mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 03:35:22 +00:00
remove merged back deprecate code
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -18,7 +18,6 @@ package controller
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -576,15 +575,6 @@ func (b *backupReconciler) validateAndGetSnapshotLocations(backup *velerov1api.B
|
||||
|
||||
func (b *backupReconciler) runBackup(backup *pkgbackup.Request) error {
|
||||
b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)).Info("Setting up backup log")
|
||||
logFile, err := os.CreateTemp("", "")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error creating temp file for backup log")
|
||||
}
|
||||
gzippedLogFile := gzip.NewWriter(logFile)
|
||||
// Assuming we successfully uploaded the log file, this will have already been closed below. It is safe to call
|
||||
// close multiple times. If we get an error closing this, there's not really anything we can do about it.
|
||||
defer gzippedLogFile.Close()
|
||||
defer closeAndRemoveFile(logFile, b.logger.WithField(Backup, kubeutil.NamespaceAndName(backup)))
|
||||
|
||||
// Log the backup to both a backup log file and to stdout. This will help see what happened if the upload of the
|
||||
// backup log failed for whatever reason.
|
||||
|
||||
@@ -19,7 +19,6 @@ package controller
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -146,7 +145,7 @@ func (r *backupFinalizerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
||||
return ctrl.Result{}, errors.Wrap(err, "error downloading backup")
|
||||
}
|
||||
defer closeAndRemoveFile(inBackupFile, log)
|
||||
outBackupFile, err = ioutil.TempFile("", "")
|
||||
outBackupFile, err = os.CreateTemp("", "")
|
||||
if err != nil {
|
||||
log.WithError(err).Error("error creating temp file for backup")
|
||||
return ctrl.Result{}, errors.WithStack(err)
|
||||
|
||||
@@ -19,7 +19,6 @@ package logging
|
||||
import (
|
||||
"compress/gzip"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -47,7 +46,7 @@ type tempFileLogger struct {
|
||||
|
||||
// NewTempFileLogger creates a DualModeLogger instance that writes logs to both Stdout and a file in the temp folder.
|
||||
func NewTempFileLogger(logLevel logrus.Level, logFormat Format, hook *LogHook, fields logrus.Fields) (DualModeLogger, error) {
|
||||
file, err := ioutil.TempFile("", "")
|
||||
file, err := os.CreateTemp("", "")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error creating temp file")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user