Created
October 22, 2014 09:26
-
-
Save kszarek/28e4569c9f6e26ace008 to your computer and use it in GitHub Desktop.
Custom task for fabric
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomTask(Task): | |
def __init__(self, func, myarg, *args, **kwargs): | |
super(CustomTask, self).__init__(*args, **kwargs) | |
self.func = func | |
self.myarg = myarg | |
if env.hosts == []: | |
logger.debug("env.hosts is empty") | |
# if hasattr(env, 'env_name'): | |
logger.debug("Found env_name in env") | |
set_dynamic_inventory() | |
def run(self, *args, **kwargs): | |
return self.func(*args, **kwargs) | |
@task(task_class=CustomTask, myarg='value') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment