def remote_diff_slurp(nodes, filename): try: import parallax except ImportError: raise ValueError("Parallax is required to diff") from . import tmpfiles tmpdir = tmpfiles.create_dir() opts = parallax.Options() opts.localdir = tmpdir dst = os.path.basename(filename) return parallax.slurp(nodes, filename, dst, opts).items()
def testCopyFile(self): opts = para.Options() opts.default_user = g_user opts.localdir = self.tmpDir by_host = para.copy(g_hosts, "/etc/hosts", "/tmp/para.test", opts) for host, result in by_host.items(): if isinstance(result, para.Error): raise result rc, _, _ = result self.assertEqual(rc, 0) by_host = para.slurp(g_hosts, "/tmp/para.test", "para.test", opts) for host, result in by_host.items(): if isinstance(result, para.Error): raise result rc, _, _, path = result self.assertEqual(rc, 0) self.assert_(path.endswith('%s/para.test' % (host)))
def slurp(self): dst = os.path.basename(self.filename) results = parallax.slurp(self.nodes, self.filename, dst, self.opts) return self.handle(list(results.items()))
def _diff_slurp(pssh, nodes, filename): tmpdir = tmpfiles.create_dir() opts = pssh.Options() opts.localdir = tmpdir dst = os.path.basename(filename) return pssh.slurp(nodes, filename, dst, opts).items()