Ignore:
Timestamp:
Oct 29, 2009, 12:52:59 AM (15 years ago)
Author:
price
Message:

Style fixes in, and Debian changelog for, list and listuser.

Location:
trunk/packages/invirt-remote/server/usr/sbin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-list

    r2511 r2516  
    11#!/usr/bin/python
    22"""
    3 Returns a user's list of vm's
     3Lists the VMs belonging to the remote user.
    44"""
    55
     
    77import sys
    88import os
    9 import yaml
     9
    1010
    1111def main(argv):
    1212    if len(argv) < 1:
    13         print >>sys.stderr, "usage: invirt-remote-list "
     13        print >>sys.stderr, "usage: invirt-remote-list"
    1414        return 2
    15     username = os.environ['REMUSER'].rsplit('@ATHENA.MIT.EDU')[0]
     15
     16    username = os.environ['REMOTE_USER'].rsplit('@ATHENA.MIT.EDU')[0]
    1617    p = Popen(['/usr/sbin/invirt-remote-listuser', username], stdout=PIPE)
    1718    output = p.communicate()[0]
     
    2021    return p.returncode
    2122
     23
    2224if __name__ == '__main__':
    2325    sys.exit(main(sys.argv))
    24 
    25 # vim:et:sw=4:ts=4
  • trunk/packages/invirt-remote/server/usr/sbin/invirt-remote-listuser

    r2510 r2516  
    11#!/usr/bin/python
    22"""
    3 Lists what a user's VM's are
     3Lists the VMs belonging to a given user.
    44"""
    55
    6 from subprocess import PIPE, Popen, call
    76import sys
    87import yaml
    98
    109from invirt import database
    11 from invirt.database import Machine, MachineAccess
    1210
    1311
     
    1917
    2018    database.connect()
    21     machines = Machine.query().join('acl').filter_by(user=username)
    2219    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)
    2922
    3023    print yaml.dump(output, Dumper=yaml.CSafeDumper, default_flow_style=False)
    3124    return 0
     25
     26
    3227if __name__ == '__main__':
    3328    sys.exit(main(sys.argv))
    34 
    35 # vim:et:sw=4:ts=4
Note: See TracChangeset for help on using the changeset viewer.