[ 
https://issues.apache.org/jira/browse/STORM-160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14614282#comment-14614282
 ] 

ASF GitHub Bot commented on STORM-160:
--------------------------------------

Github user HeartSaVioR commented on a diff in the pull request:

    https://github.com/apache/storm/pull/575#discussion_r33895557
  
    --- Diff: storm-core/src/jvm/backtype/storm/utils/ShellProcess.java ---
    @@ -48,8 +50,31 @@ public ShellProcess(String[] command) {
             this.command = command;
         }
     
    +    public void setEnv(Map<String, String> env) {
    +        this.env = env;
    +    }
    +
    +    private void modifyEnvironment(Map<String, String> buildEnv) {
    +        for (Map.Entry<String, String> entry : env.entrySet()) {
    +            if ("PATH".equals(entry.getKey())) {
    +                buildEnv.put("PATH", buildEnv.get("PATH") + 
File.pathSeparatorChar + env.get("PATH"));
    +            } else {
    +                buildEnv.put(entry.getKey(), entry.getValue());
    +            }
    +        }
    +    }
    +
    +
         public Number launch(Map conf, TopologyContext context) {
             ProcessBuilder builder = new ProcessBuilder(command);
    +        if (!env.isEmpty()) {
    +            Map<String, String> buildEnv = builder.environment();
    +            modifyEnvironment(buildEnv);
    +        }
    +        for(Map.Entry<String, String> entry : 
builder.environment().entrySet()) {
    --- End diff --
    
    @bourneagain
    Github points out different line, I mean 74 line and belows, why call 
System.out.println() for each entry, prefix with "SHYAM:"?


> Allow ShellBolt to set env vars (particularly PATH)
> ---------------------------------------------------
>
>                 Key: STORM-160
>                 URL: https://issues.apache.org/jira/browse/STORM-160
>             Project: Apache Storm
>          Issue Type: New Feature
>            Reporter: James Xu
>            Priority: Minor
>              Labels: newbie
>
> https://github.com/nathanmarz/storm/issues/32
> While trying to implement a multilang based bolt, I discovered that binaries 
> outside of /usr/bin, /usr/sbin, and /sbin, are not found despite being 
> installed in say, /usr/local/bin.
> Is there a way to specify a PATH variable so when storm creates the sub 
> shell, these binaries can be located by name? If not, can we get one added?
> ----------
> nathanmarz: This is a good idea. For the meantime, does using the full path 
> of the binary (e.g., /usr/local/bin/python) work around this issue?
> ----------
> dinedal: That works for processes that don't require any other environment 
> variables.
> Also, in cases where developers have multiple versions of a program (say, 
> RVM) and the production servers have another one installed on the system, it 
> means changing code for deploying the topology.
> ----------
> nicoo: +1
> To work around this issue you can start your multilang bolt from a bash 
> script that set all needed env vars.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to