-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've always used my states to create the virtualenv and add python
packages to it. It looks something like this:
First, create virtualenv:
venv:
virtualenv.managed:
- name: /path/to/virtualenv
- distribute: True
Then add packages in requirements file to virtual env:
pip-pkgs:
pip.installed:
- requirements: /path/to/PACKAGES.pip
- bin_env: /path/to/virtualenv
- require:
- virtualenv: venv
And/or add single package to virtual env:
celery:
pip.installed:
- bin_env: /path/to/virtualenv
- upgrade: True
- require:
- virtualenv: venv
- From there, I run a script to execute code that has to run within the
virtualenv.
However, to use a salt cmd state to run python code within a virtualenv,
you might get by with providing the FULL path to the python binary when
you call your command. Try something like this:
related_fields_patch:
cmd.run:
- user: administrator
- cwd: /home/administrator/www/treeio
- name: /path/to/virtualenv/bin/python related_fields_patch.py
`/path/to/virtualenv/bin/python -c "import ....."`
- require:
- virtualenv: venv
- git: tree-io-clone
A bash tip: Instead of doing cmd && cmd, you can place the first part
where the $DJANGO_DIR variable is as I demonstrated above. That will
make it one command.
I hope that helps.
Nick
> --
> You received this message because you are subscribed to the Google
> Groups "Salt-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
salt-users+...@googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird -
http://www.enigmail.net/
iEYEARECAAYFAlIfULcACgkQYoNGId/piAuuvQCfeM3SJrQ0DQ8jeCJW9F5au01F
pAEAniUqp0c+efD01nmzD1zwMwAXHXd6
=hDzu
-----END PGP SIGNATURE-----