Skip to content

Commit

Permalink
update ShellCommandFencer
Browse files Browse the repository at this point in the history
  • Loading branch information
fuchaohong committed Jul 17, 2024
1 parent be91412 commit ca48b8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public final Map<String, String> getFencingParameters() {
* expose to fencing implementations/scripts. Fencing methods are free
* to use this map as they see fit -- notably, the shell script
* implementation takes each entry, prepends 'target_', substitutes
* '_' for '.', and adds it to the environment of the script.
* '_' for '.' and '-', and adds it to the environment of the script.
*
* Subclass implementations should be sure to delegate to the superclass
* implementation as well as adding their own keys.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
* (cmd.exe on Windows) and may not include any closing parentheses.<p>
*
* The shell command will be run with an environment set up to contain
* all of the current Hadoop configuration variables, with the '_' character
* replacing any '.' characters in the configuration keys.<p>
* all of the current Hadoop configuration variables, with the '_' character
* replacing any '.' or '-' characters in the configuration keys.<p>
*
* If the shell command returns an exit code of 0, the fencing is
* determined to be successful. If it returns any other exit code, the
Expand Down Expand Up @@ -202,7 +202,7 @@ private static String tryGetPid(Process p) {

/**
* Set the environment of the subprocess to be the Configuration,
* with '.'s replaced by '_'s.
* with '.'s and '-'s replaced by '_'s.
*/
private void setConfAsEnvVars(Map<String, String> env) {
for (Map.Entry<String, String> pair : getConf()) {
Expand Down Expand Up @@ -237,7 +237,7 @@ private void addTargetInfoAsEnvVars(HAServiceTarget target,
for (Map.Entry<String, String> e :
target.getFencingParameters().entrySet()) {
String key = prefix + e.getKey();
key = key.replace('.', '_');
key = key.replaceAll("[.-]", "_");
environment.put(key, e.getValue());
}
}
Expand Down

0 comments on commit ca48b8f

Please sign in to comment.