|
Last change
on this file since 3025 was
2516,
checked in by price, 16 years ago
|
|
Style fixes in, and Debian changelog for, list and listuser.
|
-
Property svn:executable set to
*
|
|
File size:
598 bytes
|
| Rev | Line | |
|---|
| [2508] | 1 | #!/usr/bin/python |
|---|
| 2 | """ |
|---|
| [2516] | 3 | Lists the VMs belonging to a given user. |
|---|
| [2508] | 4 | """ |
|---|
| 5 | |
|---|
| 6 | import sys |
|---|
| 7 | import yaml |
|---|
| 8 | |
|---|
| 9 | from invirt import database |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | def main(argv): |
|---|
| 13 | if len(argv) < 2: |
|---|
| 14 | print >>sys.stderr, "usage: invirt-remote-listuser <user>" |
|---|
| 15 | return 2 |
|---|
| 16 | username = argv[1] |
|---|
| 17 | |
|---|
| 18 | database.connect() |
|---|
| [2509] | 19 | output = {} |
|---|
| [2516] | 20 | for m in database.Machine.query().join('acl').filter_by(user=username): |
|---|
| 21 | output[m.name] = dict(owner=m.owner, contact=m.contact) |
|---|
| [2509] | 22 | |
|---|
| 23 | print yaml.dump(output, Dumper=yaml.CSafeDumper, default_flow_style=False) |
|---|
| [2508] | 24 | return 0 |
|---|
| [2516] | 25 | |
|---|
| 26 | |
|---|
| [2508] | 27 | if __name__ == '__main__': |
|---|
| 28 | sys.exit(main(sys.argv)) |
|---|
Note: See
TracBrowser
for help on using the repository browser.