File tree Expand file tree Collapse file tree 3 files changed +40
-9
lines changed
distribution/packages/src/common/scripts
qa/os/src/test/java/org/elasticsearch/packaging/test Expand file tree Collapse file tree 3 files changed +40
-9
lines changed Original file line number Diff line number Diff line change @@ -122,15 +122,6 @@ if [ "x$IS_UPGRADE" != "xtrue" ]; then
122122 echo " sudo systemctl start elasticsearch.service"
123123 fi
124124 set -e
125-
126- elif [ "$RESTART_ON_UPGRADE" = "true" ]; then
127-
128- echo -n "Restarting elasticsearch service..."
129- if command -v systemctl >/dev/null; then
130- systemctl daemon-reload
131- systemctl restart elasticsearch.service || true
132- fi
133- echo " OK"
134125fi
135126
136127# the equivalent code for rpm is in posttrans
@@ -149,4 +140,14 @@ if [ "$PACKAGE" = "deb" ]; then
149140 fi
150141fi
151142
143+ if [ "$RESTART_ON_UPGRADE" = "true" ]; then
144+
145+ echo -n "Restarting elasticsearch service..."
146+ if command -v systemctl >/dev/null; then
147+ systemctl daemon-reload
148+ systemctl restart elasticsearch.service || true
149+ fi
150+ echo " OK"
151+ fi
152+
152153@scripts.footer@
Original file line number Diff line number Diff line change 1+ pr : 84224
2+ summary : Restart ES after keystore upgrade in postinst
3+ area : Packaging
4+ type : bug
5+ issues :
6+ - 82433
Original file line number Diff line number Diff line change 99package org .elasticsearch .packaging .test ;
1010
1111import org .elasticsearch .packaging .util .Distribution ;
12+ import org .elasticsearch .packaging .util .Packages ;
13+ import org .elasticsearch .packaging .util .ServerUtils ;
1214import org .junit .BeforeClass ;
1315
1416import java .nio .file .Paths ;
@@ -83,5 +85,27 @@ public void test30Purge() throws Exception {
8385 assertPathsDoNotExist (installation .config , installation .envFile );
8486
8587 assertThat (packageStatus (distribution ()).exitCode (), is (1 ));
88+
89+ installation = null ;
90+ }
91+
92+ /**
93+ * Check that restarting on upgrade doesn't run into a problem where the keystore
94+ * upgrade is attempted as the wrong user i.e. the restart happens at the correct
95+ * point. See #82433.
96+ */
97+ public void test40RestartOnUpgrade () throws Exception {
98+ assertRemoved (distribution ());
99+ installation = installPackage (sh , distribution ());
100+ assertInstalled (distribution ());
101+
102+ // Ensure ES is started
103+ Packages .runElasticsearchStartCommand (sh );
104+ ServerUtils .waitForElasticsearch (installation );
105+
106+ sh .getEnv ().put ("RESTART_ON_UPGRADE" , "true" );
107+ installation = installPackage (sh , distribution ());
108+
109+ ServerUtils .waitForElasticsearch (installation );
86110 }
87111}
You can’t perform that action at this time.
0 commit comments