Skip to content

Commit 7ff676c

Browse files
Copy attributes when backing up and restoring custom configurations (#63619)
1 parent e6d04dc commit 7ff676c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

qa/os/src/test/java/org/elasticsearch/packaging/test/PackagingTestCase.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import java.nio.file.Files;
5959
import java.nio.file.Path;
6060
import java.nio.file.Paths;
61+
import java.nio.file.StandardCopyOption;
6162
import java.nio.file.attribute.FileAttribute;
6263
import java.nio.file.attribute.PosixFilePermissions;
6364
import java.util.Collections;
@@ -431,7 +432,7 @@ public void withCustomConfig(CheckedConsumer<Path, Exception> action) throws Exc
431432
Platforms.onLinux(() -> sh.run("chown -R elasticsearch:elasticsearch " + tempDir));
432433

433434
if (distribution.isPackage()) {
434-
Files.copy(installation.envFile, tempDir.resolve("elasticsearch.bk"));// backup
435+
Files.copy(installation.envFile, tempDir.resolve("elasticsearch.bk"), StandardCopyOption.COPY_ATTRIBUTES);// backup
435436
append(installation.envFile, "ES_PATH_CONF=" + tempConf + "\n");
436437
} else {
437438
sh.getEnv().put("ES_PATH_CONF", tempConf.toString());
@@ -440,7 +441,7 @@ public void withCustomConfig(CheckedConsumer<Path, Exception> action) throws Exc
440441
action.accept(tempConf);
441442
if (distribution.isPackage()) {
442443
IOUtils.rm(installation.envFile);
443-
Files.copy(tempDir.resolve("elasticsearch.bk"), installation.envFile);
444+
Files.copy(tempDir.resolve("elasticsearch.bk"), installation.envFile, StandardCopyOption.COPY_ATTRIBUTES);
444445
} else {
445446
sh.getEnv().remove("ES_PATH_CONF");
446447
}

0 commit comments

Comments
 (0)