Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- from fabric.api import env, roles, task
- from fabric.tasks import Task
- env.roledefs['my_role'] = ['localhost', '127.0.0.1']
- class CustomTask(Task):
- def __init__(self, func, *args, **kwargs):
- super(CustomTask, self).__init__(*args, **kwargs)
- self.func = func
- def run(self, *args, **kwargs):
- print("I want to do something here")
- return self.func(*args, **kwargs)
- @task(task_class=CustomTask)
- def cmd1():
- print('hello there')
- # @roles('my_role') # Uncomment this and 'fab -l' will fail
- @task(task_class=CustomTask)
- def cmd2():
- print('hello you')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement