1

This question is similar to - Pass parameter to fabric task

My problem is that I want to deploy my sphinx html documentation to a remote server.

I also want to define a remote directory where i copy the files to, for each host separately, outside the task function, preferably also outside the fabfile.

Community
  • 1
  • 1
Markus Unterwaditzer
  • 7,992
  • 32
  • 60

1 Answers1

1

Use a dictionary if the hosts and paths are known ahead of time or could be computed. EG:

env.sphinx_path = {
    'hosta': 'patha',
    'hostb': 'pathb',
}

@task
@hosts('hosta','hostb')
def foo(dummy_var):
    put('sphinx_stuff', env.sphinx_path%env.host)

Otherwise you could just pass the path like:

fab foo:'sphinx/path'

And that would populate dummy_var in the above example for you to then use in the task.

Morgan
  • 4,143
  • 27
  • 35