From d6609d5fc243d264f1c97dfeb9ac130d7e81f8a3 Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Fri, 13 Dec 2024 14:51:59 +0530 Subject: [PATCH] MM-60336: Allow ability to create empty OS https://mattermost.atlassian.net/browse/MM-60336 --- deployment/config.go | 8 -------- deployment/terraform/create.go | 6 +++++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/deployment/config.go b/deployment/config.go index a35286dc0..7d17e5596 100644 --- a/deployment/config.go +++ b/deployment/config.go @@ -464,14 +464,6 @@ func (c *Config) validateElasticSearchConfig() error { return fmt.Errorf("Incorrect engine version: %s. Must start with %q", c.ElasticSearchSettings.Version, "OpenSearch") } - if c.ElasticSearchSettings.SnapshotRepository == "" { - return fmt.Errorf("Empty SnapshotRepository. Must supply a value") - } - - if c.ElasticSearchSettings.SnapshotName == "" { - return fmt.Errorf("Empty SnapshotName. Must supply a value") - } - return nil } diff --git a/deployment/terraform/create.go b/deployment/terraform/create.go index f3807b7fe..b8da1d3d4 100644 --- a/deployment/terraform/create.go +++ b/deployment/terraform/create.go @@ -540,6 +540,11 @@ func (t *Terraform) setupElasticSearchServer(extAgent *ssh.ExtAgent, ip string) mlog.Debug("Repositories registered", mlog.Array("repositories", repositories)) repo := esSettings.SnapshotRepository + snapshotName := esSettings.SnapshotName + if snapshotName == "" { + mlog.Debug("No Opensearch snapshot name given. Not restoring to any snapshot.") + return nil + } // Check if the registered repositories already include the one configured repoFound := false @@ -568,7 +573,6 @@ func (t *Terraform) setupElasticSearchServer(extAgent *ssh.ExtAgent, ip string) // Look for the configured snapshot var snapshot opensearch.Snapshot - snapshotName := esSettings.SnapshotName for _, s := range snapshots { if s.Name == snapshotName { snapshot = s