Last change
on this file since 2511 was
2510,
checked in by pweaver, 15 years ago
|
Deleted extra print statement
|
-
Property svn:executable set to
*
|
File size:
770 bytes
|
Line | |
---|
1 | #!/usr/bin/python |
---|
2 | """ |
---|
3 | Lists what a user's VM's are |
---|
4 | """ |
---|
5 | |
---|
6 | from subprocess import PIPE, Popen, call |
---|
7 | import sys |
---|
8 | import yaml |
---|
9 | |
---|
10 | from invirt import database |
---|
11 | from invirt.database import Machine, MachineAccess |
---|
12 | |
---|
13 | |
---|
14 | def main(argv): |
---|
15 | if len(argv) < 2: |
---|
16 | print >>sys.stderr, "usage: invirt-remote-listuser <user>" |
---|
17 | return 2 |
---|
18 | username = argv[1] |
---|
19 | |
---|
20 | database.connect() |
---|
21 | machines = Machine.query().join('acl').filter_by(user=username) |
---|
22 | output = {} |
---|
23 | for m in machines: |
---|
24 | |
---|
25 | data = {} |
---|
26 | data['owner']=m.owner |
---|
27 | data['contact'] = m.contact |
---|
28 | output[m.name] = data |
---|
29 | |
---|
30 | print yaml.dump(output, Dumper=yaml.CSafeDumper, default_flow_style=False) |
---|
31 | return 0 |
---|
32 | if __name__ == '__main__': |
---|
33 | sys.exit(main(sys.argv)) |
---|
34 | |
---|
35 | # vim:et:sw=4:ts=4 |
---|
Note: See
TracBrowser
for help on using the repository browser.