Index: trunk/packages/invirt-console/debian/invirt-console-server.install
===================================================================
--- trunk/packages/invirt-console/debian/invirt-console-server.install	(revision 1813)
+++ trunk/packages/invirt-console/debian/invirt-console-server.install	(revision 1814)
@@ -1,1 +1,1 @@
-files/* .
+server/* .
Index: trunk/packages/invirt-console/files/etc/conserver/conserver.cf.invirt
===================================================================
--- trunk/packages/invirt-console/files/etc/conserver/conserver.cf.invirt	(revision 1813)
+++ 	(revision )
@@ -1,23 +1,0 @@
-# default config for console
-config * {
-	sslrequired yes;
-}
-# If no consoles are defined, as is the case when the host first boots
-# up, conserver will quit. This keeps it running.
-#
-# Should someone create a VM called dummy-console, their VM will
-# shadow over this one
-console dummy-console {
-        master localhost;
-        type noop;
-}
-
-default * {
-        type exec;
-}
-access * {
-        trusted 127.0.0.1;
-        limited *;
-}
-
-#include /etc/conserver/invirt-hosts.cf
Index: trunk/packages/invirt-console/files/etc/conserver/console.cf
===================================================================
--- trunk/packages/invirt-console/files/etc/conserver/console.cf	(revision 1813)
+++ 	(revision )
@@ -1,5 +1,0 @@
-config * {
-  master localhost;
-  port   3109;
-  sslenabled yes;
-}
Index: trunk/packages/invirt-console/files/etc/conserver/invirt-hosts.cf.mako
===================================================================
--- trunk/packages/invirt-console/files/etc/conserver/invirt-hosts.cf.mako	(revision 1813)
+++ 	(revision )
@@ -1,4 +1,0 @@
-<% from invirt.config import structs as cfg %>\
-% for h in cfg.hosts:
-#include /etc/conserver/conf.d/${h.hostname}
-% endfor
Index: trunk/packages/invirt-console/files/etc/issue.net.no_tkt.mako
===================================================================
--- trunk/packages/invirt-console/files/etc/issue.net.no_tkt.mako	(revision 1813)
+++ 	(revision )
@@ -1,4 +1,0 @@
-<% from invirt.config import structs as cfg %>\
-You must login to the ${cfg.console.hostname} console server using
-Kerberos tickets, but your ssh client did not pass a valid ticket to the
-console server.
Index: trunk/packages/invirt-console/files/etc/issue.net.no_user
===================================================================
--- trunk/packages/invirt-console/files/etc/issue.net.no_user	(revision 1813)
+++ 	(revision )
@@ -1,2 +1,0 @@
-The VM you are attempting to access does not appear to exist.
-
Index: trunk/packages/invirt-console/files/etc/motd.invirt
===================================================================
--- trunk/packages/invirt-console/files/etc/motd.invirt	(revision 1813)
+++ 	(revision )
@@ -1,3 +1,0 @@
-
-Type Ctrl-e, then c, then . to escape from the console
-
Index: trunk/packages/invirt-console/files/etc/nss-pgsql.conf.mako
===================================================================
--- trunk/packages/invirt-console/files/etc/nss-pgsql.conf.mako	(revision 1813)
+++ 	(revision )
@@ -1,10 +1,0 @@
-<% from invirt.config import structs as cfg %>
-connectionstring = host=${cfg.db.host} dbname=${cfg.db.dbname} user=${cfg.db.user} port=${cfg.db.port}
-
-getpwnam = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines WHERE name = $1
-getpwuid = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines WHERE machine_id + 1000 = $1
-allusers = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines
-getgrnam = SELECT name, 'x', machine_id + 1000, NULL FROM machines WHERE name = $1
-getgrgid = SELECT name, 'x', machine_id + 1000, NULL FROM machines WHERE machine_id + 1000 = $1
-groups_dyn = SELECT NULL LIMIT 0;
-allgroups = SELECT name, 'x', machine_id + 1000, NULL FROM machines
Index: trunk/packages/invirt-console/files/etc/remctl/acl/invirt-console-server.mako
===================================================================
--- trunk/packages/invirt-console/files/etc/remctl/acl/invirt-console-server.mako	(revision 1813)
+++ 	(revision )
@@ -1,4 +1,0 @@
-<% from invirt.config import structs as cfg %>\
-% for h in cfg.hosts:
-host/${h.hostname}@${cfg.authn[0].realm}
-% endfor
Index: trunk/packages/invirt-console/files/etc/remctl/conf.d/invirt-console
===================================================================
--- trunk/packages/invirt-console/files/etc/remctl/conf.d/invirt-console	(revision 1813)
+++ 	(revision )
@@ -1,1 +1,0 @@
-console update /usr/sbin/invirt-console-update /etc/remctl/acl/invirt-console-server
Index: trunk/packages/invirt-console/files/usr/bin/invirt-consolefs
===================================================================
--- trunk/packages/invirt-console/files/usr/bin/invirt-consolefs	(revision 1813)
+++ 	(revision )
@@ -1,94 +1,0 @@
-#!/usr/bin/python
-
-import routefs
-from routes import Mapper
-
-from syslog import *
-from time import time
-
-import os
-import errno
-
-from invirt.config import structs as config
-from invirt import database
-
-realpath = "/home/machines/"
-
-class ConsoleFS(routefs.RouteFS):
-    """
-    ConsoleFS creates a series of subdirectories each mirroring the same real
-    directory, except for a single file - the .k5login - which is dynamically
-    generated for each subdirectory
-    """
-    
-    def __init__(self, *args, **kw):
-        """Initialize the filesystem and set it to allow_other access besides
-        the user who mounts the filesystem (i.e. root)
-        """
-        super(ConsoleFS, self).__init__(*args, **kw)
-        self.lasttime = 0
-        self.machines = []
-        self.fuse_args.add("allow_other", True)
-        
-        openlog('invirt-consolefs ', LOG_PID, LOG_DAEMON)
-        
-        syslog(LOG_DEBUG, 'Init complete.')
-    
-    def make_map(self):
-        m = Mapper()
-        m.connect('', controller='getMachines')
-        m.connect(':machine', controller='getMirror')
-        m.connect(':machine/.k5login', controller='getK5login')
-        m.connect(':machine/*(path)', controller='getMirror')
-        return m
-    
-    def recache(self):
-        if time() - self.lasttime > 5:
-            self.lasttime = time()
-            database.clear_cache()
-            self.machines = dict((machine.name, machine) for machine in database.session.query(database.Machine).all())
-
-    def getMachines(self, **kw):
-        self.recache()
-        return self.machines.keys()
-    
-    def getMirror(self, machine, path='', **kw):
-        """Translate the path into its realpath equivalent, and return that
-        """
-        real = realpath + path
-        if os.path.isdir(real):
-            # The list is converted to a set so that we can handle the case 
-            # where there is already a .k5login in the realpath gracefully    
-            return routefs.Directory(set(os.listdir(real) + ['.k5login']))
-        elif os.path.islink(real):
-            return routefs.Symlink(os.readlink(real))
-        elif os.path.isfile(real):
-            return open(real).read()
-        else:
-            return -errno.EINVAL
-    
-    def getK5login(self, machine, **kw):
-        self.recache()
-        machine = self.machines[machine]
-        users = [acl.user for acl in machine.acl]
-        return "\n".join(map(self.userToPrinc, users) + [''])
-    
-    def mirrorPath(self, path):
-        """Translate a virtual path to its real path counterpart"""
-        return realpath + "/".join(getParts(path)[1:])
-    
-    def userToPrinc(self, user):
-        """Convert Kerberos v4-style names to v5-style and append a default
-        realm if none is specified
-        """
-        if '@' in user:
-            (princ, realm) = user.split('@')
-        else:
-            princ = user
-            realm = config.authn[0].realm
-        
-        return princ.replace('.', '/') + '@' + realm
-
-if __name__ == '__main__':
-    database.connect()
-    routefs.main(ConsoleFS)
Index: trunk/packages/invirt-console/files/usr/bin/invirt-consolesh
===================================================================
--- trunk/packages/invirt-console/files/usr/bin/invirt-consolesh	(revision 1813)
+++ 	(revision )
@@ -1,2 +1,0 @@
-#!/bin/bash
-exec /usr/bin/console "$USER"
Index: trunk/packages/invirt-console/files/usr/sbin/invirt-console-update
===================================================================
--- trunk/packages/invirt-console/files/usr/sbin/invirt-console-update	(revision 1813)
+++ 	(revision )
@@ -1,18 +1,0 @@
-#!/usr/bin/python
-import sys
-import os
-import subprocess
-
-def main(args):
-  contents = args[2]
-  hostname = os.environ['REMOTE_HOST'].lower()
-  f = file('/etc/conserver/conf.d/'+hostname, 'w')
-  f.write(contents)
-  f.close()
-  p = subprocess.Popen(['/usr/sbin/invoke-rc.d', 'conserver-server', 'reload'],
-                       stdout=subprocess.PIPE)
-  p.wait()
-  return 0
-
-if __name__ == '__main__':
-  sys.exit(main(sys.argv))
Index: trunk/packages/invirt-console/server/etc/conserver/conserver.cf.invirt
===================================================================
--- trunk/packages/invirt-console/server/etc/conserver/conserver.cf.invirt	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/conserver/conserver.cf.invirt	(revision 1814)
@@ -0,0 +1,23 @@
+# default config for console
+config * {
+	sslrequired yes;
+}
+# If no consoles are defined, as is the case when the host first boots
+# up, conserver will quit. This keeps it running.
+#
+# Should someone create a VM called dummy-console, their VM will
+# shadow over this one
+console dummy-console {
+        master localhost;
+        type noop;
+}
+
+default * {
+        type exec;
+}
+access * {
+        trusted 127.0.0.1;
+        limited *;
+}
+
+#include /etc/conserver/invirt-hosts.cf
Index: trunk/packages/invirt-console/server/etc/conserver/console.cf
===================================================================
--- trunk/packages/invirt-console/server/etc/conserver/console.cf	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/conserver/console.cf	(revision 1814)
@@ -0,0 +1,5 @@
+config * {
+  master localhost;
+  port   3109;
+  sslenabled yes;
+}
Index: trunk/packages/invirt-console/server/etc/conserver/invirt-hosts.cf.mako
===================================================================
--- trunk/packages/invirt-console/server/etc/conserver/invirt-hosts.cf.mako	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/conserver/invirt-hosts.cf.mako	(revision 1814)
@@ -0,0 +1,4 @@
+<% from invirt.config import structs as cfg %>\
+% for h in cfg.hosts:
+#include /etc/conserver/conf.d/${h.hostname}
+% endfor
Index: trunk/packages/invirt-console/server/etc/issue.net.no_tkt.mako
===================================================================
--- trunk/packages/invirt-console/server/etc/issue.net.no_tkt.mako	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/issue.net.no_tkt.mako	(revision 1814)
@@ -0,0 +1,4 @@
+<% from invirt.config import structs as cfg %>\
+You must login to the ${cfg.console.hostname} console server using
+Kerberos tickets, but your ssh client did not pass a valid ticket to the
+console server.
Index: trunk/packages/invirt-console/server/etc/issue.net.no_user
===================================================================
--- trunk/packages/invirt-console/server/etc/issue.net.no_user	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/issue.net.no_user	(revision 1814)
@@ -0,0 +1,2 @@
+The VM you are attempting to access does not appear to exist.
+
Index: trunk/packages/invirt-console/server/etc/motd.invirt
===================================================================
--- trunk/packages/invirt-console/server/etc/motd.invirt	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/motd.invirt	(revision 1814)
@@ -0,0 +1,3 @@
+
+Type Ctrl-e, then c, then . to escape from the console
+
Index: trunk/packages/invirt-console/server/etc/nss-pgsql.conf.mako
===================================================================
--- trunk/packages/invirt-console/server/etc/nss-pgsql.conf.mako	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/nss-pgsql.conf.mako	(revision 1814)
@@ -0,0 +1,10 @@
+<% from invirt.config import structs as cfg %>
+connectionstring = host=${cfg.db.host} dbname=${cfg.db.dbname} user=${cfg.db.user} port=${cfg.db.port}
+
+getpwnam = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines WHERE name = $1
+getpwuid = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines WHERE machine_id + 1000 = $1
+allusers = SELECT name, '*', name, '/consolefs/'|| name, '/usr/bin/invirt-consolesh', machine_id + 1000, machine_id + 1000 FROM machines
+getgrnam = SELECT name, 'x', machine_id + 1000, NULL FROM machines WHERE name = $1
+getgrgid = SELECT name, 'x', machine_id + 1000, NULL FROM machines WHERE machine_id + 1000 = $1
+groups_dyn = SELECT NULL LIMIT 0;
+allgroups = SELECT name, 'x', machine_id + 1000, NULL FROM machines
Index: trunk/packages/invirt-console/server/etc/remctl/acl/invirt-console-server.mako
===================================================================
--- trunk/packages/invirt-console/server/etc/remctl/acl/invirt-console-server.mako	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/remctl/acl/invirt-console-server.mako	(revision 1814)
@@ -0,0 +1,4 @@
+<% from invirt.config import structs as cfg %>\
+% for h in cfg.hosts:
+host/${h.hostname}@${cfg.authn[0].realm}
+% endfor
Index: trunk/packages/invirt-console/server/etc/remctl/conf.d/invirt-console
===================================================================
--- trunk/packages/invirt-console/server/etc/remctl/conf.d/invirt-console	(revision 1814)
+++ trunk/packages/invirt-console/server/etc/remctl/conf.d/invirt-console	(revision 1814)
@@ -0,0 +1,1 @@
+console update /usr/sbin/invirt-console-update /etc/remctl/acl/invirt-console-server
Index: trunk/packages/invirt-console/server/usr/bin/invirt-consolefs
===================================================================
--- trunk/packages/invirt-console/server/usr/bin/invirt-consolefs	(revision 1814)
+++ trunk/packages/invirt-console/server/usr/bin/invirt-consolefs	(revision 1814)
@@ -0,0 +1,94 @@
+#!/usr/bin/python
+
+import routefs
+from routes import Mapper
+
+from syslog import *
+from time import time
+
+import os
+import errno
+
+from invirt.config import structs as config
+from invirt import database
+
+realpath = "/home/machines/"
+
+class ConsoleFS(routefs.RouteFS):
+    """
+    ConsoleFS creates a series of subdirectories each mirroring the same real
+    directory, except for a single file - the .k5login - which is dynamically
+    generated for each subdirectory
+    """
+    
+    def __init__(self, *args, **kw):
+        """Initialize the filesystem and set it to allow_other access besides
+        the user who mounts the filesystem (i.e. root)
+        """
+        super(ConsoleFS, self).__init__(*args, **kw)
+        self.lasttime = 0
+        self.machines = []
+        self.fuse_args.add("allow_other", True)
+        
+        openlog('invirt-consolefs ', LOG_PID, LOG_DAEMON)
+        
+        syslog(LOG_DEBUG, 'Init complete.')
+    
+    def make_map(self):
+        m = Mapper()
+        m.connect('', controller='getMachines')
+        m.connect(':machine', controller='getMirror')
+        m.connect(':machine/.k5login', controller='getK5login')
+        m.connect(':machine/*(path)', controller='getMirror')
+        return m
+    
+    def recache(self):
+        if time() - self.lasttime > 5:
+            self.lasttime = time()
+            database.clear_cache()
+            self.machines = dict((machine.name, machine) for machine in database.session.query(database.Machine).all())
+
+    def getMachines(self, **kw):
+        self.recache()
+        return self.machines.keys()
+    
+    def getMirror(self, machine, path='', **kw):
+        """Translate the path into its realpath equivalent, and return that
+        """
+        real = realpath + path
+        if os.path.isdir(real):
+            # The list is converted to a set so that we can handle the case 
+            # where there is already a .k5login in the realpath gracefully    
+            return routefs.Directory(set(os.listdir(real) + ['.k5login']))
+        elif os.path.islink(real):
+            return routefs.Symlink(os.readlink(real))
+        elif os.path.isfile(real):
+            return open(real).read()
+        else:
+            return -errno.EINVAL
+    
+    def getK5login(self, machine, **kw):
+        self.recache()
+        machine = self.machines[machine]
+        users = [acl.user for acl in machine.acl]
+        return "\n".join(map(self.userToPrinc, users) + [''])
+    
+    def mirrorPath(self, path):
+        """Translate a virtual path to its real path counterpart"""
+        return realpath + "/".join(getParts(path)[1:])
+    
+    def userToPrinc(self, user):
+        """Convert Kerberos v4-style names to v5-style and append a default
+        realm if none is specified
+        """
+        if '@' in user:
+            (princ, realm) = user.split('@')
+        else:
+            princ = user
+            realm = config.authn[0].realm
+        
+        return princ.replace('.', '/') + '@' + realm
+
+if __name__ == '__main__':
+    database.connect()
+    routefs.main(ConsoleFS)
Index: trunk/packages/invirt-console/server/usr/bin/invirt-consolesh
===================================================================
--- trunk/packages/invirt-console/server/usr/bin/invirt-consolesh	(revision 1814)
+++ trunk/packages/invirt-console/server/usr/bin/invirt-consolesh	(revision 1814)
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec /usr/bin/console "$USER"
Index: trunk/packages/invirt-console/server/usr/sbin/invirt-console-update
===================================================================
--- trunk/packages/invirt-console/server/usr/sbin/invirt-console-update	(revision 1814)
+++ trunk/packages/invirt-console/server/usr/sbin/invirt-console-update	(revision 1814)
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+import sys
+import os
+import subprocess
+
+def main(args):
+  contents = args[2]
+  hostname = os.environ['REMOTE_HOST'].lower()
+  f = file('/etc/conserver/conf.d/'+hostname, 'w')
+  f.write(contents)
+  f.close()
+  p = subprocess.Popen(['/usr/sbin/invoke-rc.d', 'conserver-server', 'reload'],
+                       stdout=subprocess.PIPE)
+  p.wait()
+  return 0
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))
