本文整理汇总了Python中ClusterShell.Worker.Pdsh.WorkerPdsh.node_buffer方法的典型用法代码示例。如果您正苦于以下问题:Python WorkerPdsh.node_buffer方法的具体用法?Python WorkerPdsh.node_buffer怎么用?Python WorkerPdsh.node_buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClusterShell.Worker.Pdsh.WorkerPdsh
的用法示例。
在下文中一共展示了WorkerPdsh.node_buffer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWorkerPdshGetCommand
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testWorkerPdshGetCommand(self):
# test worker.command with WorkerPdsh
worker1 = WorkerPdsh(HOSTNAME, command="/bin/echo foo bar fuu",
handler=None, timeout=5)
self._task.schedule(worker1)
worker2 = WorkerPdsh(HOSTNAME, command="/bin/echo blah blah foo",
handler=None, timeout=5)
self._task.schedule(worker2)
# run task
self._task.resume()
# test output
self.assertEqual(worker1.node_buffer(HOSTNAME), b"foo bar fuu")
self.assertEqual(worker1.command, "/bin/echo foo bar fuu")
self.assertEqual(worker2.node_buffer(HOSTNAME), b"blah blah foo")
self.assertEqual(worker2.command, "/bin/echo blah blah foo")
示例2: testWorkerPdshGetCommand
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testWorkerPdshGetCommand(self):
"""test worker.command with WorkerPdsh"""
worker1 = WorkerPdsh("localhost", command="/bin/echo foo bar fuu",
handler=None, timeout=5)
self.assert_(worker1 != None)
self._task.schedule(worker1)
worker2 = WorkerPdsh("localhost", command="/bin/echo blah blah foo",
handler=None, timeout=5)
self.assert_(worker2 != None)
self._task.schedule(worker2)
# run task
self._task.resume()
# test output
self.assertEqual(worker1.node_buffer("localhost"), "foo bar fuu")
self.assertEqual(worker1.command, "/bin/echo foo bar fuu")
self.assertEqual(worker2.node_buffer("localhost"), "blah blah foo")
self.assertEqual(worker2.command, "/bin/echo blah blah foo")
示例3: testEscapePdsh2
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testEscapePdsh2(self):
"""test distant worker (pdsh) cmd with non-escaped variable"""
worker = WorkerPdsh("localhost", command="export CSTEST=foobar; /bin/echo $CSTEST | sed 's/\ foo/bar/'",
handler=None, timeout=None)
self._task.schedule(worker)
# execute
self._task.resume()
# read result
self.assertEqual(worker.node_buffer("localhost"), "foobar")
示例4: testEscapePdsh2
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testEscapePdsh2(self):
# test distant worker (pdsh) cmd with non-escaped variable
cmd = r"export CSTEST=foobar; /bin/echo $CSTEST | sed 's/\ foo/bar/'"
worker = WorkerPdsh(HOSTNAME, command=cmd, handler=None, timeout=None)
self._task.schedule(worker)
# execute
self._task.resume()
# read result
self.assertEqual(worker.node_buffer(HOSTNAME), b"foobar")
示例5: testExplicitPdshWorker
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testExplicitPdshWorker(self):
# test simple localhost command with explicit pdsh worker
# init worker
worker = WorkerPdsh(HOSTNAME, command="echo alright", handler=None)
self._task.schedule(worker)
# run task
self._task.resume()
# test output
self.assertEqual(worker.node_buffer(HOSTNAME), b"alright")
示例6: testExplicitPdshWorker
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testExplicitPdshWorker(self):
"""test simple localhost command with explicit pdsh worker"""
# init worker
worker = WorkerPdsh("localhost", command="echo alright", handler=None, timeout=5)
self.assert_(worker != None)
self._task.schedule(worker)
# run task
self._task.resume()
# test output
self.assertEqual(worker.node_buffer("localhost"), "alright")
示例7: testEscapePdsh
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testEscapePdsh(self):
# test distant worker (pdsh) cmd with escaped variable
worker = WorkerPdsh(HOSTNAME, command="export CSTEST=foobar; /bin/echo \$CSTEST | sed 's/\ foo/bar/'",
handler=None, timeout=None)
#task.set_info("debug", True)
self._task.schedule(worker)
# execute
self._task.resume()
# read result
self.assertEqual(worker.node_buffer(HOSTNAME), "$CSTEST")
示例8: testShellPdshEventsNoReadNoTimeout
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testShellPdshEventsNoReadNoTimeout(self):
# test triggered events (no read, no timeout) with explicit pdsh worker
test_eh = self.__class__.TEventHandlerChecker(self)
worker = WorkerPdsh(HOSTNAME, command="sleep 2", handler=test_eh,
timeout=None)
self._task.schedule(worker)
# run task
self._task.resume()
# test events received: start, close
self.assertEqual(test_eh.flags, EV_START | EV_PICKUP | EV_HUP | EV_CLOSE)
self.assertEqual(worker.node_buffer(HOSTNAME), None)
示例9: testExplicitWorkerPdshShellEventsWithTimeout
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testExplicitWorkerPdshShellEventsWithTimeout(self):
# test triggered events (with timeout) with explicit pdsh worker
test_eh = self.__class__.TEventHandlerChecker(self)
worker = WorkerPdsh(HOSTNAME, command="echo alright && sleep 10",
handler=test_eh, timeout=2)
self._task.schedule(worker)
# run task
self._task.resume()
# test events received: start, read, timeout, close
self.assertEqual(test_eh.flags, EV_START | EV_PICKUP | EV_READ | EV_TIMEOUT | EV_CLOSE)
self.assertEqual(worker.node_buffer(HOSTNAME), b"alright")
示例10: testExplicitPdshWorkerWithOptions
# 需要导入模块: from ClusterShell.Worker.Pdsh import WorkerPdsh [as 别名]
# 或者: from ClusterShell.Worker.Pdsh.WorkerPdsh import node_buffer [as 别名]
def testExplicitPdshWorkerWithOptions(self):
self._task.set_info("pdsh_path", "/usr/bin/pdsh -S")
worker = WorkerPdsh(HOSTNAME, command="echo alright", handler=None)
self._task.schedule(worker)
# run task
self._task.resume()
# test output
self.assertEqual(worker.node_buffer(HOSTNAME), b"alright")
# clear options after test
task_cleanup()
self.assertEqual(task_self().info("pdsh_path"), None)