Browse Source

Packaging: Unmark systemd service file as a config file (#29004)

Systemd overrides should happen through /etc/systemd/system, not
directly editing the service file. This commit removes marking the
service file as configuration for rpm and deb packages.
Ryan Ernst 7 years ago
parent
commit
fba2f00a73

+ 0 - 1
distribution/packages/build.gradle

@@ -178,7 +178,6 @@ Closure commonPackageConfig(String type, boolean oss) {
     }
 
     // ========= systemd =========
-    configurationFile '/usr/lib/systemd/system/elasticsearch.service'
     into('/usr/lib/tmpfiles.d') {
       from "${packagingFiles}/systemd/elasticsearch.conf"
     }

+ 1 - 0
docs/CHANGELOG.asciidoc

@@ -26,6 +26,7 @@ This section summarizes the changes in each release.
 <<write-thread-pool-fallback, Removed `thread_pool.bulk.*` settings and
 `es.thread_pool.write.use_bulk_as_display_name` system property>> ({pull}29609[#29609])
 
+<<systemd-service-file-config, Systemd service file is no longer marked as configuration>> ({pull}29004[#29004])
 <<remove-suggest-metric, Removed `suggest` metric on stats APIs>> ({pull}29635[#29635])
 
 <<remove-field-caps-body, In field capabilities APIs, removed support for providing fields in the request body>> ({pull}30185[#30185])

+ 2 - 0
docs/reference/migration/migrate_7_0.asciidoc

@@ -28,6 +28,7 @@ Elasticsearch 6.x in order to be readable by Elasticsearch 7.x.
 * <<breaking_70_indices_changes>>
 * <<breaking_70_mappings_changes>>
 * <<breaking_70_search_changes>>
+* <<breaking_70_packaging_changes>>
 * <<breaking_70_plugins_changes>>
 * <<breaking_70_analysis_changes>>
 * <<breaking_70_api_changes>>
@@ -41,6 +42,7 @@ include::migrate_7_0/cluster.asciidoc[]
 include::migrate_7_0/indices.asciidoc[]
 include::migrate_7_0/mappings.asciidoc[]
 include::migrate_7_0/search.asciidoc[]
+include::migrate_7_0/packaging.asciidoc[]
 include::migrate_7_0/plugins.asciidoc[]
 include::migrate_7_0/api.asciidoc[]
 include::migrate_7_0/java.asciidoc[]

+ 10 - 0
docs/reference/migration/migrate_7_0/packaging.asciidoc

@@ -0,0 +1,10 @@
+[[breaking_70_packaging_changes]]
+=== Packaging changes
+
+[[systemd-service-file-config]]
+==== systemd service file is no longer configuration
+
+The systemd service file `/usr/lib/systemd/system/elasticsearch.service`
+was previously marked as a configuration file in rpm and deb packages.
+Overrides to the systemd elasticsearch service should be made
+in `/etc/systemd/system/elasticsearch.service.d/override.conf`.

+ 6 - 3
qa/vagrant/src/test/resources/packaging/tests/30_deb_package.bats

@@ -131,9 +131,13 @@ setup() {
     # The removal must disable the service
     # see prerm file
     if is_systemd; then
-        # Debian systemd distros usually returns exit code 3
+        missing_exit_code=4
+        if [ $(systemctl --version | head -1 | awk '{print $2}') -lt 231 ]; then
+          # systemd before version 231 used exit code 3 when the service did not exist
+          missing_exit_code=3
+        fi
         run systemctl status elasticsearch.service
-        [ "$status" -eq 3 ]
+        [ "$status" -eq $missing_exit_code ]
 
         run systemctl is-enabled elasticsearch.service
         [ "$status" -eq 1 ]
@@ -166,7 +170,6 @@ setup() {
 
     # The service files are still here
     assert_file_exist "/etc/init.d/elasticsearch"
-    assert_file_exist "/usr/lib/systemd/system/elasticsearch.service"
 }
 
 @test "[DEB] purge package" {