Last change
on this file since 2710 was
2516,
checked in by price, 15 years ago
|
Style fixes in, and Debian changelog for, list and listuser.
|
-
Property svn:executable set to
*
|
File size:
598 bytes
|
Line | |
---|
1 | #!/usr/bin/python |
---|
2 | """ |
---|
3 | Lists the VMs belonging to a given user. |
---|
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() |
---|
19 | output = {} |
---|
20 | for m in database.Machine.query().join('acl').filter_by(user=username): |
---|
21 | output[m.name] = dict(owner=m.owner, contact=m.contact) |
---|
22 | |
---|
23 | print yaml.dump(output, Dumper=yaml.CSafeDumper, default_flow_style=False) |
---|
24 | return 0 |
---|
25 | |
---|
26 | |
---|
27 | if __name__ == '__main__': |
---|
28 | sys.exit(main(sys.argv)) |
---|
Note: See
TracBrowser
for help on using the repository browser.