On Thursday, June 25, 2015 at 11:29:15 PM UTC-5, ayy...@orzota.com wrote:
>
> 1. I am trying to run 3 shell scripts. In first shell scripts i added some 
> env variable in bashrc file and i sourced. 
> 2. In second shell script contain that env variable. But that env variable 
> is not reflected in second shell script. Is it possible do fix this 
> problem. 
>
>
The nature of the problem is unclear to me.  You mention three shell 
scripts, but describe behavior and effects only for two, and even there I'm 
not sure I follow your description.  It is also unclear whether you expect 
the environment variable to be defined in all three scripts, or whether you 
expect it to NOT be defined in one or more of them.  Moreover, it is 
unclear just how you are inducing Puppet to run these scripts for you, and 
the details make a difference.

Supposing that you are using the Exec resource type and its 'shell' 
provider, you should expect the scripts to be run via /bin/sh, in 
non-interactive mode.  Note in particular that if your /bin/sh happens to 
be Bash, then that will result in different behavior than if the shell were 
launched under a different name, or if it was launched in interactive mode, 
as described in Bash's documentation.  In particular, when started in that 
way, bash will run in non-interactive POSIX mode, and among other things, 
that means it will not automatically read any startup files.  Of course, 
whatever script is presented to it may explicitly source whatever file you 
like (subject to any effective access controls that may be in place). Also, 
you may specify environment variables directly via the `Exec` resource 
declaration.

You should also be aware that every program or script launched via an Exec 
runs in its own environment.  They inherit very little from the agent's own 
environment, and they can neither modify the agent's environment nor 
directly modify the environment that any other program or script will run 
in.  Some of those characteristics are intentional on Puppet's part, 
whereas others are simply incontrovertible characteristics of the overall 
operating system.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/307a51f4-291e-4cff-81e3-2c38fa048312%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to