Remove NOREPLACE for /etc/elasticsearch in rpm and deb (#37839)

The /etc/elasticsearch directory is currently configured as a config
file with noreplace. However, the directory itself is not config, and
can lead to an entire /etc/elasticsearch.rpmsave directory in some
situations. This commit fixes the ospackage config to not specify those
file bits for the directory itself, but only the files underneath it.
This commit is contained in:
Ryan Ernst 2019-01-25 08:11:48 -08:00 committed by GitHub
parent acc3cae40c
commit e88ae99340
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -83,6 +83,9 @@ void addProcessFilesTask(String type, boolean oss) {
mkdir "${packagingFiles}/var/log/elasticsearch"
mkdir "${packagingFiles}/var/lib/elasticsearch"
mkdir "${packagingFiles}/usr/share/elasticsearch/plugins"
// bare empty dir for /etc/elasticsearch
mkdir "${packagingFiles}/elasticsearch"
}
}
}
@ -173,14 +176,22 @@ Closure commonPackageConfig(String type, boolean oss) {
configurationFile '/etc/elasticsearch/users'
configurationFile '/etc/elasticsearch/users_roles'
}
into('/etc') {
from("${packagingFiles}") {
dirMode 02750
into('/etc')
permissionGroup 'elasticsearch'
includeEmptyDirs true
createDirectoryEntry true
include("elasticsearch") // empty dir, just to add directory entry
}
from("${packagingFiles}/etc/elasticsearch") {
into('/etc/elasticsearch')
dirMode 02750
fileMode 0660
permissionGroup 'elasticsearch'
includeEmptyDirs true
createDirectoryEntry true
fileType CONFIG | NOREPLACE
from "${packagingFiles}/etc"
}
String envFile = expansionsForDistribution(type, false)['path.env']
configurationFile envFile