2
# Copyright (c) 2010-2011 OpenStack, LLC.
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
8
# http://www.apache.org/licenses/LICENSE-2.0
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14
# See the License for the specific language governing permissions and
15
# limitations under the License.
20
# If ../keystone/__init__.py exists, add ../ to Python search path, so that
21
# it will override what happens to be installed in /usr/(local/)lib/python...
22
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
25
if os.path.exists(os.path.join(possible_topdir, 'keystone', '__init__.py')):
26
sys.path.insert(0, possible_topdir)
29
import keystone.db.sqlalchemy.api as db_api
30
from keystone.db.sqlalchemy import models
34
usage = "usage: %prog group_id group_desc"
35
parser = optparse.OptionParser(usage)
36
options, args = parser.parse_args()
38
parser.error("Incorrect number of arguments")
43
g = db_api.group_get(group)
45
raise IndexError("Group not found")
47
values = {'desc': desc}
48
db_api.group_update(group, values)
49
print 'Group', g.id, 'updated.'
51
print 'Error updating user', group, ':', str(e)
53
if __name__ == '__main__':