def execute(self, group, command, *args, **kwargs):
"""Executes the given command with XML-RPC protocol
Executes the given command with the given parameters
Returns an iterator to navigate to navigate through the result set
returned by Fabric
"""
try:
grp = getattr(self.handler.proxy, group)
cmd = getattr(grp, command)
except AttributeError as exc:
raise ValueError("{group}.{command} not available ({err})".format(
group=group, command=command, err=str(exc)))
fab_set = None
try:
data = cmd(*args, **kwargs)
fab_set = FabricSet(data)
except (Fault, socket.error, InterfaceError) as exc:
msg = "Executing {group}.{command} failed: {error}".format(
group=group, command=command, error=str(exc))
raise InterfaceError(msg)
return fab_set
评论列表
文章目录