Move invirt.remote Python module to invirt-remote-server
authorEvan Broder <broder@mit.edu>
Mon, 10 Nov 2008 20:20:04 +0000 (15:20 -0500)
committerEvan Broder <broder@mit.edu>
Mon, 10 Nov 2008 20:20:04 +0000 (15:20 -0500)
svn path=/trunk/packages/invirt-remote-server/; revision=1597

debian/changelog
debian/control
debian/pycompat [new file with mode: 0644]
debian/rules
python/remote/__init__.py [new file with mode: 0644]
python/remote/bcast.py [new file with mode: 0644]
setup.py [new file with mode: 0755]

index 228098c..8a3e564 100644 (file)
@@ -1,3 +1,9 @@
+invirt-remote-server (0.0.15) unstable; urgency=low
+
+  * Include invirt.remote Python module
+
+ -- Evan Broder <broder@mit.edu>  Mon, 10 Nov 2008 15:15:13 -0500
+
 invirt-remote-server (0.0.14) unstable; urgency=low
 
   * Don't depend on invirt-mail-config
index e0b9f52..51de82e 100644 (file)
@@ -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 <invirt@mit.edu>
+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 (file)
index 0000000..0cfbf08
--- /dev/null
@@ -0,0 +1 @@
+2
index e6192f6..e90e462 100755 (executable)
@@ -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 (file)
index 0000000..adaa9b7
--- /dev/null
@@ -0,0 +1 @@
+from bcast import bcast
diff --git a/python/remote/bcast.py b/python/remote/bcast.py
new file mode 100644 (file)
index 0000000..0d7dba2
--- /dev/null
@@ -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 (executable)
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'}
+)