Skip to content

Commit be91412

Browse files
author
fuchaohong
committed
ShellCommandFencer#setConfAsEnvVars should also replace '-' with '_'.
1 parent b4ddb2d commit be91412

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ShellCommandFencer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private static String tryGetPid(Process p) {
206206
*/
207207
private void setConfAsEnvVars(Map<String, String> env) {
208208
for (Map.Entry<String, String> pair : getConf()) {
209-
env.put(pair.getKey().replace('.', '_'), pair.getValue());
209+
env.put(pair.getKey().replaceAll("[.-]", "_"), pair.getValue());
210210
}
211211
}
212212

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ha/TestShellCommandFencer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void resetLogSpy() {
6363

6464
private static ShellCommandFencer createFencer() {
6565
Configuration conf = new Configuration();
66-
conf.set("in.fencing.tests", "yessir");
66+
conf.set("in.fencing-tests", "yessir");
6767
ShellCommandFencer fencer = new ShellCommandFencer();
6868
fencer.setConf(conf);
6969
return fencer;

0 commit comments

Comments
 (0)