- Timestamp:
- Oct 29, 2009, 12:52:59 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-listuser
r2510 r2516 1 1 #!/usr/bin/python 2 2 """ 3 Lists what a user's VM's are3 Lists the VMs belonging to a given user. 4 4 """ 5 5 6 from subprocess import PIPE, Popen, call7 6 import sys 8 7 import yaml 9 8 10 9 from invirt import database 11 from invirt.database import Machine, MachineAccess12 10 13 11 … … 19 17 20 18 database.connect() 21 machines = Machine.query().join('acl').filter_by(user=username)22 19 output = {} 23 for m in machines: 24 25 data = {} 26 data['owner']=m.owner 27 data['contact'] = m.contact 28 output[m.name] = data 20 for m in database.Machine.query().join('acl').filter_by(user=username): 21 output[m.name] = dict(owner=m.owner, contact=m.contact) 29 22 30 23 print yaml.dump(output, Dumper=yaml.CSafeDumper, default_flow_style=False) 31 24 return 0 25 26 32 27 if __name__ == '__main__': 33 28 sys.exit(main(sys.argv)) 34 35 # vim:et:sw=4:ts=4
Note: See TracChangeset
for help on using the changeset viewer.