if len(args) != 1:
parser.print_help(sys.stderr)
return 1
- owner = args[0]
+ owner_id = args[0]
database.connect()
database.session.begin()
- x = database.Owner.query().filter_by(owner_id=owner).first()
- if x is None:
- x = database.Owner(owner_id=owner)
+ owner = database.Owner.query().filter_by(owner_id=owner_id).first()
+ if owner is None:
+ owner = database.Owner(owner_id=owner_id)
for resource, scope in [('ram', 'total'), ('ram', 'single'),
('disk', 'total'), ('disk', 'single'),
('vms', 'total'), ('vms', 'active')]:
val = getattr(opts, resource+scope)
if val is not None:
- setattr(x, resource+'_quota_'+scope, val if val >= 0 else None)
+ setattr(owner, resource+'_quota_'+scope, val if val >= 0 else None)
database.session.commit()
- print str(x)
+ print owner
return 0
if __name__ == '__main__':