Changeset 2199 for trunk/packages/invirt-database/scripts
- Timestamp:
- Feb 27, 2009, 2:56:46 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-database/scripts/invirt-quota
r2198 r2199 44 44 parser.print_help(sys.stderr) 45 45 return 1 46 owner = args[0]46 owner_id = args[0] 47 47 database.connect() 48 48 database.session.begin() 49 49 50 x = database.Owner.query().filter_by(owner_id=owner).first()51 if xis None:52 x = database.Owner(owner_id=owner)50 owner = database.Owner.query().filter_by(owner_id=owner_id).first() 51 if owner is None: 52 owner = database.Owner(owner_id=owner_id) 53 53 54 54 for resource, scope in [('ram', 'total'), ('ram', 'single'), … … 57 57 val = getattr(opts, resource+scope) 58 58 if val is not None: 59 setattr( x, resource+'_quota_'+scope, val if val >= 0 else None)59 setattr(owner, resource+'_quota_'+scope, val if val >= 0 else None) 60 60 61 61 database.session.commit() 62 print str(x)62 print owner 63 63 return 0 64 64
Note: See TracChangeset
for help on using the changeset viewer.