本文整理汇总了Python中ClusterShell.Worker.Pdsh.WorkerPdsh.node_error_buffer方法的典型用法代码示例。如果您正苦于以下问题:Python WorkerPdsh.node_error_buffer方法的具体用法?Python WorkerPdsh.node_error_buffer怎么用?Python WorkerPdsh.node_error_buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClusterShell.Worker.Pdsh.WorkerPdsh
的用法示例。
在下文中一共展示了WorkerPdsh.node_error_buffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testExplicitPdshWorkerStdErr
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_error_buffer [as 别名]
def testExplicitPdshWorkerStdErr(self):
# test simple localhost command with explicit pdsh worker (stderr)
worker = WorkerPdsh(HOSTNAME, command="echo alright 1>&2",
handler=None, stderr=True)
self._task.schedule(worker)
# run task
self._task.resume()
# test output
self.assertEqual(worker.node_error_buffer(HOSTNAME), b"alright")
# Re-test with stderr=False
worker = WorkerPdsh(HOSTNAME, command="echo alright 1>&2",
handler=None, stderr=False)
self._task.schedule(worker)
# run task
self._task.resume()
# test output
self.assertEqual(worker.node_error_buffer(HOSTNAME), None)
示例2: testExplicitPdshWorkerStdErr
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_error_buffer [as 别名]
def testExplicitPdshWorkerStdErr(self):
"""test simple localhost command with explicit pdsh worker (stderr)"""
# init worker
worker = WorkerPdsh("localhost", command="echo alright 1>&2",
handler=None, stderr=True, timeout=5)
self.assert_(worker != None)
self._task.schedule(worker)
# run task
self._task.resume()
# test output
self.assertEqual(worker.node_error_buffer("localhost"), "alright")
# Re-test with stderr=False
worker = WorkerPdsh("localhost", command="echo alright 1>&2",
handler=None, stderr=False, timeout=5)
self.assert_(worker != None)
self._task.schedule(worker)
# run task
self._task.resume()
# test output
self.assertEqual(worker.node_error_buffer("localhost"), None)