Run Fab file inside python script

I have a fab script, it works fine. To run it, I do:

 fab -H 192.168.xx.xx deployFiles deployConfiguration:'master',7 

deployFiles and deployConfiguration are both functions in my fabfile.py . 'master' and 7 are my parameters for deployConfiguration

I have another Python script, and I want to run the previous fab command inside it.

How can I execute my file with these parameters from a Python script?

+4
source share
1 answer

You simply import them and call them. Using either the settings context manager or setting the appropriate settings on fabric.api.env

 from fabric.context_managers import settings from fabfile import deployFiles, deployConfiguration with settings(host_string=' user@192.168.xx.xx '): deployFiles() deployConfiguration('master', 7) 
+13
source

All Articles