本文整理匯總了Python中ClusterShell.Worker.Worker.DistantWorker._on_node_msgline方法的典型用法代碼示例。如果您正苦於以下問題:Python DistantWorker._on_node_msgline方法的具體用法?Python DistantWorker._on_node_msgline怎麽用?Python DistantWorker._on_node_msgline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ClusterShell.Worker.Worker.DistantWorker
的用法示例。
在下文中一共展示了DistantWorker._on_node_msgline方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _on_remote_node_msgline
# 需要導入模塊: from ClusterShell.Worker.Worker import DistantWorker [as 別名]
# 或者: from ClusterShell.Worker.Worker.DistantWorker import _on_node_msgline [as 別名]
def _on_remote_node_msgline(self, node, msg, sname, gateway):
"""remote msg received"""
if not self.source or not self.reverse or sname != 'stdout':
DistantWorker._on_node_msgline(self, node, msg, sname)
return
# rcopy only: we expect base64 encoded tar content on stdout
encoded = self._rcopy_bufs.setdefault(node, '') + msg
if node not in self._rcopy_tars:
self._rcopy_tars[node] = tempfile.TemporaryFile()
# partial base64 decoding requires a multiple of 4 characters
encoded_sz = (len(encoded) // 4) * 4
# write decoded binary msg to node temporary tarfile
self._rcopy_tars[node].write(base64.b64decode(encoded[0:encoded_sz]))
# keep trailing encoded chars for next time
self._rcopy_bufs[node] = encoded[encoded_sz:]
示例2: _on_remote_node_msgline
# 需要導入模塊: from ClusterShell.Worker.Worker import DistantWorker [as 別名]
# 或者: from ClusterShell.Worker.Worker.DistantWorker import _on_node_msgline [as 別名]
def _on_remote_node_msgline(self, node, msg, sname, gateway):
DistantWorker._on_node_msgline(self, node, msg, sname)