def hosts(*host_list): """ Decorator defining which host or hosts to execute the wrapped function on. @hosts('user1@host1', 'host2', 'user2@host3') def my_func(): pass Servers must be specified using the key in the configuration file and will be returned to fabric using the addr field. """ return _list_annotating_decorator('hosts', parse_servers(host_list))
def roles(*role_list): """ Decorator defining a list of role names, used to look up host lists. it updates roledefs first and then returns the decorator env.roledefs.update({ 'webserver': ['www1', 'www2'], 'dbserver': ['db1'] }) @roles('webserver', 'user@dbserver') def my_func(): pass """ host_list = [] for role in role_list: host_list.append("role="+role) parse_servers(host_list) return _list_annotating_decorator('roles', *role_list)
def roles(*role_list): """ Decorator defining a list of role names, used to look up host lists. it updates roledefs first and then returns the decorator env.roledefs.update({ 'webserver': ['www1', 'www2'], 'dbserver': ['db1'] }) @roles('webserver', 'user@dbserver') def my_func(): pass """ host_list = [] for role in role_list: host_list.append("role=" + role) parse_servers(host_list) return _list_annotating_decorator('roles', *role_list)