Added list script.
authorPaul Weaver <pweaver@mit.edu>
Tue, 20 Oct 2009 02:37:26 +0000 (22:37 -0400)
committerPaul Weaver <pweaver@mit.edu>
Tue, 20 Oct 2009 02:37:26 +0000 (22:37 -0400)
Lists a user's VM's (based on their tickets)

remctl list randomarg
remctl still requires an argument after list even though it doens't do anything

svn path=/trunk/packages/invirt-remote/; revision=2511

server/etc/remctl/conf.d/invirt-web
server/usr/sbin/invirt-remote-list [new file with mode: 0755]

index 52fc1ec..620a8c4 100644 (file)
@@ -1,5 +1,6 @@
 web      ALL   /usr/sbin/invirt-remote-proxy-web  /etc/remctl/remconffs/adminacl
 listuser ALL   /usr/sbin/invirt-remote-listuser          /etc/remctl/remconffs/adminacl
+list    ALL   /usr/sbin/invirt-remote-list       ANYUSER
 control  help  /usr/sbin/invirt-remctl-help       ANYUSER
 include /etc/remctl/remconffs/conf
 control  ALL   /usr/sbin/invirt-remote-vminvalid  ANYUSER
diff --git a/server/usr/sbin/invirt-remote-list b/server/usr/sbin/invirt-remote-list
new file mode 100755 (executable)
index 0000000..40a90ea
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+"""
+Returns a user's list of vm's
+"""
+
+from subprocess import PIPE, Popen, call
+import sys
+import os
+import yaml
+
+def main(argv):
+    if len(argv) < 1:
+        print >>sys.stderr, "usage: invirt-remote-list "
+        return 2
+    username = os.environ['REMUSER'].rsplit('@ATHENA.MIT.EDU')[0]
+    p = Popen(['/usr/sbin/invirt-remote-listuser', username], stdout=PIPE)
+    output = p.communicate()[0]
+
+    print output
+    return p.returncode
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv))
+
+# vim:et:sw=4:ts=4