Created
April 16, 2013 14:54
-
-
Save calvinchengx/5396595 to your computer and use it in GitHub Desktop.
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
from fabric.api import env | |
from functools import wraps | |
def get_target_name(f): | |
@wraps(f) | |
def wrapper(*args, **kwargs): | |
print("I am in the decorator") | |
for key, value in env.project_sites.iteritems(): | |
for k, v in value.iteritems(): | |
if v == env.host: | |
print(key) | |
_env_get(key) | |
return f(*args, **kwargs) | |
return wrapper | |
@get_target_name | |
def host_type(): | |
print("worker running") | |
run('uname -s') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment