mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 12:56:53 +00:00
[Package] Remove bin/lib/modules directories on RPM uninstall/upgrade (#20448)
When uninstalling or upgrading elasticsearch using the RPM package some empty directories remain on the filesystem: /usr/share/elasticsearch/bin /usr/share/elasticsearch/lib /usr/share/elasticsearch/modules /usr/share/elasticsearch/modules/foo Having empty directories in modules can prevent elasticsearch to start after an upgrade: the plugins service expects to find a plugin-descriptor.properties file in every sub directory of modules. This PR cleans things a bit so that these empty directories are removed on upgrade/removal like it was in 2.x.
This commit is contained in:
parent
3a7a437594
commit
3caaafa4bd
@ -36,6 +36,17 @@ task buildRpm(type: Rpm) {
|
||||
fileMode 0644
|
||||
addParentDirs false
|
||||
// TODO ospackage doesn't support icon but we used to have one
|
||||
|
||||
// Declare the folders so that the RPM package manager removes
|
||||
// them when upgrading or removing the package
|
||||
directory('/usr/share/elasticsearch/bin', 0755)
|
||||
directory('/usr/share/elasticsearch/lib', 0755)
|
||||
directory('/usr/share/elasticsearch/modules', 0755)
|
||||
modulesFiles.eachFile { FileCopyDetails fcp ->
|
||||
if (fcp.name == "plugin-descriptor.properties") {
|
||||
directory('/usr/share/elasticsearch/modules/' + fcp.file.parentFile.name, 0755)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
|
@ -127,8 +127,15 @@ setup() {
|
||||
# see postrm file
|
||||
assert_file_not_exist "/var/log/elasticsearch"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/plugins"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules"
|
||||
assert_file_not_exist "/var/run/elasticsearch"
|
||||
|
||||
# Those directories are removed by the package manager
|
||||
assert_file_not_exist "/usr/share/elasticsearch/bin"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/lib"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules/lang-painless"
|
||||
|
||||
# The configuration files are still here
|
||||
assert_file_exist "/etc/elasticsearch"
|
||||
assert_file_exist "/etc/elasticsearch/scripts"
|
||||
|
@ -116,8 +116,15 @@ setup() {
|
||||
# see postrm file
|
||||
assert_file_not_exist "/var/log/elasticsearch"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/plugins"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules"
|
||||
assert_file_not_exist "/var/run/elasticsearch"
|
||||
|
||||
# Those directories are removed by the package manager
|
||||
assert_file_not_exist "/usr/share/elasticsearch/bin"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/lib"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules/lang-painless"
|
||||
|
||||
assert_file_not_exist "/etc/elasticsearch"
|
||||
assert_file_not_exist "/etc/elasticsearch/scripts"
|
||||
assert_file_not_exist "/etc/elasticsearch/elasticsearch.yml"
|
||||
@ -158,8 +165,14 @@ setup() {
|
||||
# see postrm file
|
||||
assert_file_not_exist "/var/log/elasticsearch"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/plugins"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules"
|
||||
assert_file_not_exist "/var/run/elasticsearch"
|
||||
|
||||
assert_file_not_exist "/usr/share/elasticsearch/bin"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/lib"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules"
|
||||
assert_file_not_exist "/usr/share/elasticsearch/modules/lang-painless"
|
||||
|
||||
assert_file_not_exist "/etc/elasticsearch/elasticsearch.yml"
|
||||
assert_file_exist "/etc/elasticsearch/elasticsearch.yml.rpmsave"
|
||||
assert_file_not_exist "/etc/elasticsearch/jvm.options"
|
||||
|
Loading…
x
Reference in New Issue
Block a user