From 541869a96ad234944b9aff3123a4bf7ff5e1d616 Mon Sep 17 00:00:00 2001 From: Alpar Torok Date: Tue, 27 Nov 2018 16:38:56 +0200 Subject: [PATCH] Add missing entries to conffiles (#35810) --- distribution/packages/build.gradle | 4 ++ .../test/DebPreservationTestCase.java | 10 +++++ .../test/RpmPreservationTestCase.java | 43 ++++++++++++++----- .../packaging/util/Distribution.java | 8 ++++ 4 files changed, 55 insertions(+), 10 deletions(-) diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index 4fdaa5c1a01..13aa86addd4 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -167,6 +167,10 @@ Closure commonPackageConfig(String type, boolean oss) { configurationFile '/etc/elasticsearch/elasticsearch.yml' configurationFile '/etc/elasticsearch/jvm.options' configurationFile '/etc/elasticsearch/log4j2.properties' + configurationFile '/etc/elasticsearch/role_mapping.yml' + configurationFile '/etc/elasticsearch/roles.yml' + configurationFile '/etc/elasticsearch/users' + configurationFile '/etc/elasticsearch/users_roles' into('/etc/elasticsearch') { dirMode 0750 fileMode 0660 diff --git a/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/DebPreservationTestCase.java b/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/DebPreservationTestCase.java index c584f5d2e44..522c038fc2b 100644 --- a/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/DebPreservationTestCase.java +++ b/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/DebPreservationTestCase.java @@ -87,6 +87,16 @@ public abstract class DebPreservationTestCase extends PackagingTestCase { installation.config("log4j2.properties") ); + if (distribution().isDefault()) { + assertPathsExist( + installation.config, + installation.config("role_mapping.yml"), + installation.config("roles.yml"), + installation.config("users"), + installation.config("users_roles") + ); + } + // keystore was removed assertPathsDontExist( diff --git a/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/RpmPreservationTestCase.java b/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/RpmPreservationTestCase.java index 527c1d2cc13..4787766ae3b 100644 --- a/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/RpmPreservationTestCase.java +++ b/qa/vagrant/src/main/java/org/elasticsearch/packaging/test/RpmPreservationTestCase.java @@ -100,10 +100,22 @@ public abstract class RpmPreservationTestCase extends PackagingTestCase { sh.run("echo foobar | " + installation.executables().elasticsearchKeystore + " add --stdin foo.bar"); Stream.of( - installation.config("elasticsearch.yml"), - installation.config("jvm.options"), - installation.config("log4j2.properties") - ).forEach(path -> append(path, "# foo")); + "elasticsearch.yml", + "jvm.options", + "log4j2.properties" + ) + .map(each -> installation.config(each)) + .forEach(path -> append(path, "# foo")); + if (distribution().isDefault()) { + Stream.of( + "role_mapping.yml", + "roles.yml", + "users", + "users_roles" + ) + .map(each -> installation.config(each)) + .forEach(path -> append(path, "# foo")); + } remove(distribution()); assertRemoved(distribution()); @@ -131,11 +143,22 @@ public abstract class RpmPreservationTestCase extends PackagingTestCase { "elasticsearch.yml", "jvm.options", "log4j2.properties" - ).forEach(configFile -> { - final Path original = installation.config(configFile); - final Path saved = installation.config(configFile + ".rpmsave"); - assertFalse(original + " should not exist", Files.exists(original)); - assertTrue(saved + " should exist", Files.exists(saved)); - }); + ).forEach(this::assertConfFilePreserved); + + if (distribution().isDefault()) { + Stream.of( + "role_mapping.yml", + "roles.yml", + "users", + "users_roles" + ).forEach(this::assertConfFilePreserved); + } + } + + private void assertConfFilePreserved(String configFile) { + final Path original = installation.config(configFile); + final Path saved = installation.config(configFile + ".rpmsave"); + assertFalse(original + " should not exist", Files.exists(original)); + assertTrue(saved + " should exist", Files.exists(saved)); } } diff --git a/qa/vagrant/src/main/java/org/elasticsearch/packaging/util/Distribution.java b/qa/vagrant/src/main/java/org/elasticsearch/packaging/util/Distribution.java index 4f0c8751ca4..7e1067fdb35 100644 --- a/qa/vagrant/src/main/java/org/elasticsearch/packaging/util/Distribution.java +++ b/qa/vagrant/src/main/java/org/elasticsearch/packaging/util/Distribution.java @@ -43,6 +43,14 @@ public enum Distribution { return flavor.name + "-" + version + packaging.extension; } + public boolean isDefault() { + return flavor.equals(Flavor.DEFAULT); + } + + public boolean isOSS() { + return flavor.equals(Flavor.OSS); + } + public enum Packaging { TAR(".tar.gz", Platforms.LINUX),