4

I have a fab script, it works fine. To start it, I execute:

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 launch, the previous fab command inside him.

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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Matt
  • 4,309
  • 7
  • 38
  • 52

1 Answers1

13

You just import them, and call them. Using either the settings context manager or setting the relevant 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)
aychedee
  • 24,871
  • 8
  • 79
  • 83