From ca50987dd58a6a7a86c81ec7ab4ae723a38f3ae7 Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Thu, 10 Oct 2024 11:23:58 +0600 Subject: [PATCH] Fix Panic on pause and resume cli Signed-off-by: souravbiswassanto --- pkg/pauser/mariadb.go | 2 +- pkg/pauser/mongodb.go | 2 +- pkg/pauser/mysql.go | 2 +- pkg/pauser/postgres.go | 2 +- pkg/resumer/mariadb.go | 2 +- pkg/resumer/mongodb.go | 2 +- pkg/resumer/mysql.go | 2 +- pkg/resumer/postgres.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/pauser/mariadb.go b/pkg/pauser/mariadb.go index f08ec8b09..0432f99f5 100644 --- a/pkg/pauser/mariadb.go +++ b/pkg/pauser/mariadb.go @@ -76,7 +76,7 @@ func (e *MariaDBPauser) Pause(name, namespace string) (bool, error) { } pauseAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || pauseAll { + if (e.onlyArchiver || pauseAll) && db.Spec.Archiver != nil { if err := PauseOrResumeMariaDBArchiver(e.kc, true, db.Spec.Archiver.Ref); err != nil { return false, err } diff --git a/pkg/pauser/mongodb.go b/pkg/pauser/mongodb.go index 1f55ba649..4801071c8 100644 --- a/pkg/pauser/mongodb.go +++ b/pkg/pauser/mongodb.go @@ -76,7 +76,7 @@ func (e *MongoDBPauser) Pause(name, namespace string) (bool, error) { } pauseAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || pauseAll { + if (e.onlyArchiver || pauseAll) && db.Spec.Archiver != nil { if err := PauseOrResumeMongoDBArchiver(e.kc, true, db.Spec.Archiver.Ref); err != nil { return false, err } diff --git a/pkg/pauser/mysql.go b/pkg/pauser/mysql.go index 81bc7010b..3253585e1 100644 --- a/pkg/pauser/mysql.go +++ b/pkg/pauser/mysql.go @@ -75,7 +75,7 @@ func (e *MySQLPauser) Pause(name string, namespace string) (bool, error) { return false, nil } pauseAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || pauseAll { + if (e.onlyArchiver || pauseAll) && db.Spec.Archiver != nil { if err := PauseOrResumeMySQLArchiver(e.kc, true, db.Spec.Archiver.Ref); err != nil { return false, err } diff --git a/pkg/pauser/postgres.go b/pkg/pauser/postgres.go index b1aa49c16..1dd7aa49e 100644 --- a/pkg/pauser/postgres.go +++ b/pkg/pauser/postgres.go @@ -77,7 +77,7 @@ func (e *PostgresPauser) Pause(name, namespace string) (bool, error) { pauseAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || pauseAll { + if (e.onlyArchiver || pauseAll) && db.Spec.Archiver != nil { if err := PauseOrResumePostgresArchiver(e.kc, true, db.Spec.Archiver.Ref); err != nil { return false, err } diff --git a/pkg/resumer/mariadb.go b/pkg/resumer/mariadb.go index 5647ced86..0ff7ff562 100644 --- a/pkg/resumer/mariadb.go +++ b/pkg/resumer/mariadb.go @@ -76,7 +76,7 @@ func (e *MariaDBResumer) Resume(name, namespace string) (bool, error) { resumeAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || resumeAll { + if (e.onlyArchiver || resumeAll) && db.Spec.Archiver != nil { if err := pautil.PauseOrResumeMariaDBArchiver(e.kc, false, db.Spec.Archiver.Ref); err != nil { return false, err } diff --git a/pkg/resumer/mongodb.go b/pkg/resumer/mongodb.go index 540229009..9051423da 100644 --- a/pkg/resumer/mongodb.go +++ b/pkg/resumer/mongodb.go @@ -77,7 +77,7 @@ func (e *MongoDBResumer) Resume(name, namespace string) (bool, error) { } resumeAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || resumeAll { + if (e.onlyArchiver || resumeAll) && db.Spec.Archiver != nil { if err := pautil.PauseOrResumeMongoDBArchiver(e.kc, false, db.Spec.Archiver.Ref); err != nil { return false, err } diff --git a/pkg/resumer/mysql.go b/pkg/resumer/mysql.go index cb6d303d5..0aefac22c 100644 --- a/pkg/resumer/mysql.go +++ b/pkg/resumer/mysql.go @@ -76,7 +76,7 @@ func (e *MySQLResumer) Resume(name, namespace string) (bool, error) { resumeAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || resumeAll { + if (e.onlyArchiver || resumeAll) && db.Spec.Archiver != nil { if err := pautil.PauseOrResumeMySQLArchiver(e.kc, false, db.Spec.Archiver.Ref); err != nil { return false, err } diff --git a/pkg/resumer/postgres.go b/pkg/resumer/postgres.go index f8178027e..9538c68f1 100644 --- a/pkg/resumer/postgres.go +++ b/pkg/resumer/postgres.go @@ -77,7 +77,7 @@ func (e *PostgresResumer) Resume(name, namespace string) (bool, error) { } resumeAll := !(e.onlyBackup || e.onlyDb || e.onlyArchiver) - if e.onlyArchiver || resumeAll { + if (e.onlyArchiver || resumeAll) && db.Spec.Archiver != nil { if err := pautil.PauseOrResumePostgresArchiver(e.kc, false, db.Spec.Archiver.Ref); err != nil { return false, err }