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
122
122
echo " sudo systemctl start elasticsearch.service"
123
123
fi
124
124
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"
134
125
fi
135
126
136
127
# the equivalent code for rpm is in posttrans
@@ -149,4 +140,14 @@ if [ "$PACKAGE" = "deb" ]; then
149
140
fi
150
141
fi
151
142
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
+
152
153
@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 9
9
package org .elasticsearch .packaging .test ;
10
10
11
11
import org .elasticsearch .packaging .util .Distribution ;
12
+ import org .elasticsearch .packaging .util .Packages ;
13
+ import org .elasticsearch .packaging .util .ServerUtils ;
12
14
import org .junit .BeforeClass ;
13
15
14
16
import java .nio .file .Paths ;
@@ -83,5 +85,27 @@ public void test30Purge() throws Exception {
83
85
assertPathsDoNotExist (installation .config , installation .envFile );
84
86
85
87
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 );
86
110
}
87
111
}
You can’t perform that action at this time.
0 commit comments