clustershell icon indicating copy to clipboard operation
clustershell copied to clipboard

Propagate environment variable on task

Open thiell opened this issue 12 years ago • 7 comments

It will be very interesting to set environment variables which could be set by task or worker.

# Set environment variable 
vars = { 'PATH': "...", 'LD_LIBRARY_PATH': "..." }
task.putenv(vars)
# or
worker.putenv(vars)

thiell avatar Mar 03 '12 16:03 thiell

[st-cea] Let's see if it's better to add a putenv() method or to allow modifying a task.environ or worker.environ dictionary like os.environ in Python: http://docs.python.org/library/os.html?#os.environ

Scheduled for 1.2 or 1.3

thiell avatar Mar 03 '12 16:03 thiell

[st-cea] 2 environments could be handled by the library: local environ and distant environ (depend on the worker type). Scheduled for 1.3.

thiell avatar Mar 03 '12 16:03 thiell

[st-cea] Prioritizing. :)

thiell avatar Mar 03 '12 16:03 thiell

[st-cea] Also, we could set special environ variables defined by the ClusterShell library, so remote processes could guess they are launched by ClusterShell. Those variables should be well known and documented.

thiell avatar Mar 03 '12 16:03 thiell

[st-cea] ''bump''

thiell avatar Mar 03 '12 16:03 thiell

Sorry to dig up an old task but wondered if anything further happened with this else where? i have a use case where a bunch of users can ssh into a shared account and run a script via clusterssh. it would be useful to pass some environment variable which represent the user on the host initiating the commands. I think this will likely require some configuration on the initiating host i.e. for the ssh transport adding SendEnv=CLUSTERSHELL_USER in ssh_confg but for me at least that would be an acceptable tradeoff :)

b4ldr avatar Jan 22 '21 19:01 b4ldr

If the env is already set from the originating shell, then it's just a matter of SendEnv in the ssh client conf (can be done with -o on clush) and equvalent AcceptEnv lines in the sshd_config on the remote -- nothing for us to do here.

martinetd avatar Jan 22 '21 23:01 martinetd