Revision 160e2921 lib/rpc.py
b/lib/rpc.py | ||
---|---|---|
84 | 84 |
cause bugs. |
85 | 85 |
|
86 | 86 |
""" |
87 |
def __init__(self, procedure, args):
|
|
87 |
def __init__(self, procedure, body, port):
|
|
88 | 88 |
self.procedure = procedure |
89 |
self.args = args |
|
90 |
self.body = serializer.DumpJson(args, indent=False) |
|
91 |
|
|
92 |
self.port = utils.GetNodeDaemonPort() |
|
89 |
self.body = body |
|
90 |
self.port = port |
|
93 | 91 |
self.nc = {} |
94 | 92 |
|
95 | 93 |
self._ssl_params = \ |
... | ... | |
174 | 172 |
|
175 | 173 |
""" |
176 | 174 |
self._cfg = cfg |
175 |
self.port = utils.GetNodeDaemonPort() |
|
177 | 176 |
|
178 | 177 |
def _InstDict(self, instance): |
179 | 178 |
"""Convert the given instance to a dict. |
... | ... | |
231 | 230 |
|
232 | 231 |
def _MultiNodeCall(self, node_list, procedure, args, |
233 | 232 |
address_list=None): |
234 |
c = Client(procedure, args) |
|
233 |
"""Helper for making a multi-node call |
|
234 |
|
|
235 |
""" |
|
236 |
body = serializer.DumpJson(args, indent=False) |
|
237 |
c = Client(procedure, body, self.port) |
|
235 | 238 |
if address_list is None: |
236 | 239 |
self._ConnectList(c, node_list) |
237 | 240 |
else: |
... | ... | |
241 | 244 |
@classmethod |
242 | 245 |
def _StaticMultiNodeCall(cls, node_list, procedure, args, |
243 | 246 |
address_list=None): |
244 |
c = Client(procedure, args) |
|
247 |
"""Helper for making a multi-node static call |
|
248 |
|
|
249 |
""" |
|
250 |
body = serializer.DumpJson(args, indent=False) |
|
251 |
c = Client(procedure, body, utils.GetNodeDaemonPort()) |
|
245 | 252 |
c.ConnectList(node_list, address_list=address_list) |
246 | 253 |
return c.GetResults() |
247 | 254 |
|
248 | 255 |
def _SingleNodeCall(self, node, procedure, args): |
249 |
""" |
|
256 |
"""Helper for making a single-node call
|
|
250 | 257 |
|
251 | 258 |
""" |
252 |
c = Client(procedure, args) |
|
259 |
body = serializer.DumpJson(args, indent=False) |
|
260 |
c = Client(procedure, body, self.port) |
|
253 | 261 |
self._ConnectNode(c, node) |
254 | 262 |
return c.GetResults().get(node, False) |
255 | 263 |
|
256 | 264 |
@classmethod |
257 | 265 |
def _StaticSingleNodeCall(cls, node, procedure, args): |
258 |
""" |
|
266 |
"""Helper for making a single-node static call
|
|
259 | 267 |
|
260 | 268 |
""" |
261 |
c = Client(procedure, args) |
|
269 |
body = serializer.DumpJson(args, indent=False) |
|
270 |
c = Client(procedure, body, utils.GetNodeDaemonPort()) |
|
262 | 271 |
c.ConnectNode(c, node) |
263 | 272 |
return c.GetResults().get(node, False) |
264 | 273 |
|
Also available in: Unified diff