X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/f70d04e3d9dc7d60405123bea05cd2d28b69ec4f..9b2c6cb76b2935133c0c1ed1626d077614b460ec:/server/usr/sbin/invirt-remote-listuser diff --git a/server/usr/sbin/invirt-remote-listuser b/server/usr/sbin/invirt-remote-listuser index dec6da7..38bd744 100755 --- a/server/usr/sbin/invirt-remote-listuser +++ b/server/usr/sbin/invirt-remote-listuser @@ -1,14 +1,12 @@ #!/usr/bin/python """ -Lists what a user's VM's are +Lists the VMs belonging to a given user. """ -from subprocess import PIPE, Popen, call import sys import yaml from invirt import database -from invirt.database import Machine, MachineAccess def main(argv): @@ -18,19 +16,13 @@ def main(argv): username = argv[1] database.connect() - machines = Machine.query().join('acl').filter_by(user=username) output = {} - for m in machines: - - data = {} - data['owner']=m.owner - data['contact'] = m.contact - output[m.name] = data - - print output + for m in database.Machine.query().join('acl').filter_by(user=username): + output[m.name] = dict(owner=m.owner, contact=m.contact) + print yaml.dump(output, Dumper=yaml.CSafeDumper, default_flow_style=False) return 0 + + if __name__ == '__main__': sys.exit(main(sys.argv)) - -# vim:et:sw=4:ts=4