Would something along the lines of:
{code}
command => "bash -l -c 'sudo su - panama && workon dev && mmf_eggs'",
{code}

work?

-Kevin

On Feb 8, 6:17 am, kevin c <[email protected]> wrote:
> Morning,
>
> I am trying to do some environment setup on our developer's virtual
> boxes that we use vagrant+puppet to build.  We install a python app,
> create virtualenv's for the different pip requirements, etc.
>
> Problem is that there are some custom bash macros that are available
> in our virtualenv as they are sourced in the .bashrc
>
> ie.,
> ~panama/.bashrc
> {code}
> ...
> source /usr/local/python/bin/virtualenvwrapper.sh
> ...
> {code}
>
> but when my puppet scripts tries to execute those macros, it's unable
> to as it can't load the virtual env.
>
> sample.pp
> {code}
> ...
>     exec { 'panama-eggs':
>         path    => ["/bin","/usr/bin","/usr/local/python/bin"],
>         environment => ['WORKON_HOME=/home/panama/.virtualenvs',
> 'PIP_LOG_FILE=/tmp/pip-freeze-prod.log', 'PIP_VIRTUALENV_BASE=/home/
> panama/.virtualenvs', 'VIRTUALENVWRAPPER_PYTHON=/usr/local/python/bin/
> python'],
>         command => "workon dev && mmf_eggs",
>         logoutput => "true",
>         user  => "panama",
>         group  => "panama",
>         require => [Exec["mmf-panama-install"], Exec['symlink-panama-
> post-activate']]
>     }
> ...
> {code}
>
> results in:
> ...
> err: /Stage[main]/Panama/Exec[panama-eggs]/returns: change from notrun
> to 0 failed: sh: workon: command not found
> ...
>
> fyi
> # .bash_profile
> if [ -f ~/.bashrc ]; then
>    source ~/.bashrc
>
> Any ideas on how to get puppet to recognize the macros in the "source /
> usr/local/python/bin/virtualenvwrapper.sh" for user panama?
>
> Cheers,
>
> -Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to