summaryrefslogtreecommitdiff
path: root/bin/swift-auth-recreate-accounts.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/swift-auth-recreate-accounts.py')
-rwxr-xr-xbin/swift-auth-recreate-accounts.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/swift-auth-recreate-accounts.py b/bin/swift-auth-recreate-accounts.py
new file mode 100755
index 000000000..51212b4f4
--- /dev/null
+++ b/bin/swift-auth-recreate-accounts.py
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+# Copyright (c) 2010 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from ConfigParser import ConfigParser
+from sys import argv, exit
+
+from swift.common.bufferedhttp import http_connect_raw as http_connect
+
+if __name__ == '__main__':
+ f = '/etc/swift/auth-server.conf'
+ if len(argv) == 2:
+ f = argv[1]
+ elif len(argv) != 1:
+ exit('Syntax: %s [conf_file]' % argv[0])
+ c = ConfigParser()
+ if not c.read(f):
+ exit('Unable to read conf file: %s' % f)
+ conf = dict(c.items('auth-server'))
+ host = conf.get('bind_ip', '127.0.0.1')
+ port = int(conf.get('bind_port', 11000))
+ path = '/recreate_accounts'
+ conn = http_connect(host, port, 'POST', path)
+ resp = conn.getresponse()
+ if resp.status == 200:
+ print resp.read()
+ else:
+ print 'Recreating accounts failed. (%d)' % resp.status