python - Activate a virtualenv via fabric as deploy user -


I want to run my clothes script locally, which in turn, log in to my server, user Switch to Deploy, Activate Projects. VirtualAnv, which will replace the project, and release the GIT bridge.

  def git_pull (): sudo ('su deploy') # I need to switch to Virtualenwin run here ('Git pull')  

Actually, the VirtualWrapper uses the workon command, which will keep the source of the active file and the postactivate file in the project folder. In this case, it seems that the clothes run from within the shell, the control gives up to the fabric, so I can not use the built-in bash source in the source $ ~ / .virtualenv / myvenv / bin / activate>

Someone has given an example and explanation how they did it?

Now, what can I do, which is a kundi, but works perfectly well * (This use assumes that you are using VirtualWeaver - which you should be - but you can easily mention the 'substituted' source at the place that you have mentioned, if not):

  def work (): workon = 'workon myvenv & amp; Amp; Run (Kamon + 'GIT pull') run (Varkon + 'do other stuff, etc.')  

This technique is used in fabric since version 1.0, so that you For example:

  def function: With prefix ('version mywave'): run ('git pull') ('do other stuff, etc.')  

* should be bound in cases where command1 & amp; Amp; Command2 approach can blow you up, like when Command1 fails ( command2 never runs) or if command1 is not saved properly and there are special shell characters in it.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -