Skip to content

Commit 7d7d73e

Browse files
committed
Added the try-catch for cluster.delete_component_template in clean YAML wipeTemplateForXpack
1 parent 6374312 commit 7d7d73e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/Elasticsearch/Tests/Utility.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
use Elasticsearch\Client;
2222
use Elasticsearch\ClientBuilder;
23+
use Elasticsearch\Common\Exceptions\ElasticsearchException;
2324
use Elasticsearch\Common\Exceptions\Missing404Exception;
2425

2526
class Utility
@@ -319,10 +320,15 @@ private static function wipeTemplateForXpack(Client $client): void
319320
if (self::isXPackTemplate($component['name'])) {
320321
continue;
321322
}
322-
$client->cluster()->deleteComponentTemplate([
323-
'name' => $component['name']
324-
]);
323+
try {
324+
$client->cluster()->deleteComponentTemplate([
325+
'name' => $component['name']
326+
]);
327+
} catch (ElasticsearchException $e) {
328+
// We hit a version of ES that doesn't support index templates v2 yet, so it's safe to ignore
329+
}
325330
}
331+
326332
}
327333

328334
/**

0 commit comments

Comments
 (0)