From: Evan Broder Date: Mon, 10 Nov 2008 20:20:04 +0000 (-0500) Subject: Move invirt.remote Python module to invirt-remote-server X-Git-Tag: invirt-remote-server/0.0.15~1 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/commitdiff_plain/0d3e8bfe72fd02a0829ff5f5a7d73b954651cb8e?ds=sidebyside Move invirt.remote Python module to invirt-remote-server svn path=/trunk/packages/invirt-remote-server/; revision=1597 --- diff --git a/debian/changelog b/debian/changelog index 228098c..8a3e564 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +invirt-remote-server (0.0.15) unstable; urgency=low + + * Include invirt.remote Python module + + -- Evan Broder Mon, 10 Nov 2008 15:15:13 -0500 + invirt-remote-server (0.0.14) unstable; urgency=low * Don't depend on invirt-mail-config diff --git a/debian/control b/debian/control index e0b9f52..51de82e 100644 --- a/debian/control +++ b/debian/control @@ -1,17 +1,20 @@ Source: invirt-remote-server Section: servers Priority: important -Maintainer: invirt@mit.edu -Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 5) -Standards-Version: 3.7.2 +Maintainer: Invirt project +Build-Depends: cdbs (>= 0.4.23-1.1), debhelper (>= 5), + python-all-dev (>=2.3.5-11), python-support (>= 0.5.3), + python-setuptools, python-debian, python-apt +Standards-Version: 3.8.0 Package: invirt-remote-server Architecture: all -Provides: ${diverted-files} +Provides: ${diverted-files}, ${python:Provides} Conflicts: ${diverted-files} -Depends: ${shlibs:Depends}, ${misc:Depends}, daemon, - debathena-kerberos-config, fuse-utils, openssh-server, +Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, + daemon, debathena-kerberos-config, fuse-utils, openssh-server, python-routefs, invirt-database, invirt-base, remctl-server, remctl-client +XB-Python-Version: ${python:Versions} Description: Invirt remote-control server This package should be installed to set up the remote-control server. diff --git a/debian/pycompat b/debian/pycompat new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/debian/pycompat @@ -0,0 +1 @@ +2 diff --git a/debian/rules b/debian/rules index e6192f6..e90e462 100755 --- a/debian/rules +++ b/debian/rules @@ -1,3 +1,9 @@ #!/usr/bin/make -f +DEB_PYTHON_SYSTEM=pysupport + include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/python-distutils.mk + +clean:: + rm -rf invirt.remote.egg-info diff --git a/python/remote/__init__.py b/python/remote/__init__.py new file mode 100644 index 0000000..adaa9b7 --- /dev/null +++ b/python/remote/__init__.py @@ -0,0 +1 @@ +from bcast import bcast diff --git a/python/remote/bcast.py b/python/remote/bcast.py new file mode 100644 index 0000000..0d7dba2 --- /dev/null +++ b/python/remote/bcast.py @@ -0,0 +1,19 @@ +from subprocess import PIPE, Popen +from invirt.config import structs as config +import yaml + +def bcast(cmd, hosts = [h.hostname for h in config.hosts]): + """ + Given a command and a list of hostnames or IPs, issue the command to all + the nodes and return a list of (host, output) pairs (the order should be + the same as the order of the hosts). + """ + pipes = [(host, + Popen(['remctl', host, 'remote', 'web', cmd], stdout=PIPE)) + for host in hosts] + outputs = [(s, p.communicate()[0]) for (s, p) in pipes] + for (s, p) in pipes: + if p.returncode != 0: + raise RuntimeError("remctl to host %s returned non-zero exit status %d" + % (s, p.returncode)) + return [(s, yaml.load(o, yaml.CSafeLoader)) for (s, o) in outputs] diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..f8c1a24 --- /dev/null +++ b/setup.py @@ -0,0 +1,23 @@ +#!/usr/bin/python + +from os import path +from debian_bundle.changelog import Changelog +from debian_bundle.deb822 import Deb822 +from email.utils import parseaddr +from setuptools import setup + +version = Changelog(open(path.join(path.dirname(__file__), 'debian/changelog')).read()).\ + get_version().full_version + +maintainer_full = Deb822(open(path.join(path.dirname(__file__), 'debian/control')))['Maintainer'] +maintainer, maintainer_email = parseaddr(maintainer_full) + +setup( + name='invirt.remote', + version=version, + maintainer=maintainer, + maintainer_email=maintainer_email, + + packages = ['invirt.remote'], + package_dir = {'invirt': 'python'} +)