2
# Copyright (c) 2010 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.
18
from subprocess import call
19
from sys import argv, exit
24
if __name__ == '__main__':
25
gettext.install('swift', unicode=1)
27
exit('Syntax: %s <path_to_auth.db>' % argv[0])
29
conn = sqlite3.connect(auth_db)
31
listing = conn.execute('SELECT account, cfaccount, user, password, '
32
'admin, reseller_admin FROM account')
33
except sqlite3.OperationalError, err:
34
listing = conn.execute('SELECT account, cfaccount, user, password, '
35
'"f", "f" FROM account')
36
for account, cfaccount, user, password, admin, reseller_admin in listing:
37
cmd = ['swauth-add-user', '-K', '<your_swauth_key>', '-s',
38
cfaccount.split('_', 1)[1]]
41
if reseller_admin == 't':
43
cmd.extend([account, user, password])