diff --git a/bin/swauth-add-account b/bin/swauth-add-account index fe18b5a72d..9f40429d00 100755 --- a/bin/swauth-add-account +++ b/bin/swauth-add-account @@ -51,11 +51,12 @@ if __name__ == '__main__': if parsed.scheme not in ('http', 'https'): raise Exception('Cannot handle protocol scheme %s for url %s' % (parsed.scheme, repr(options.admin_url))) - if not parsed.path: - parsed.path = '/' - elif parsed.path[-1] != '/': - parsed.path += '/' - path = '%sv2/%s' % (parsed.path, account) + parsed_path = parsed.path + if not parsed_path: + parsed_path = '/' + elif parsed_path[-1] != '/': + parsed_path += '/' + path = '%sv2/%s' % (parsed_path, account) headers = {'X-Auth-Admin-User': options.admin_user, 'X-Auth-Admin-Key': options.admin_key} if options.suffix: diff --git a/bin/swauth-add-user b/bin/swauth-add-user index 045dc0a766..365a24a085 100755 --- a/bin/swauth-add-user +++ b/bin/swauth-add-user @@ -61,12 +61,13 @@ if __name__ == '__main__': if parsed.scheme not in ('http', 'https'): raise Exception('Cannot handle protocol scheme %s for url %s' % (parsed.scheme, repr(options.admin_url))) - if not parsed.path: - parsed.path = '/' - elif parsed.path[-1] != '/': - parsed.path += '/' + parsed_path = parsed.path + if not parsed_path: + parsed_path = '/' + elif parsed_path[-1] != '/': + parsed_path += '/' # Ensure the account exists - path = '%sv2/%s' % (parsed.path, account) + path = '%sv2/%s' % (parsed_path, account) headers = {'X-Auth-Admin-User': options.admin_user, 'X-Auth-Admin-Key': options.admin_key} if options.suffix: @@ -77,7 +78,7 @@ if __name__ == '__main__': if resp.status // 100 != 2: print 'Account creation failed: %s %s' % (resp.status, resp.reason) # Add the user - path = '%sv2/%s/%s' % (parsed.path, account, user) + path = '%sv2/%s/%s' % (parsed_path, account, user) headers = {'X-Auth-Admin-User': options.admin_user, 'X-Auth-Admin-Key': options.admin_key, 'X-Auth-User-Key': password} diff --git a/bin/swauth-delete-account b/bin/swauth-delete-account index 3d98f6ec4e..8e4bd42f76 100755 --- a/bin/swauth-delete-account +++ b/bin/swauth-delete-account @@ -45,11 +45,12 @@ if __name__ == '__main__': if parsed.scheme not in ('http', 'https'): raise Exception('Cannot handle protocol scheme %s for url %s' % (parsed.scheme, repr(options.admin_url))) - if not parsed.path: - parsed.path = '/' - elif parsed.path[-1] != '/': - parsed.path += '/' - path = '%sv2/%s' % (parsed.path, account) + parsed_path = parsed.path + if not parsed_path: + parsed_path = '/' + elif parsed_path[-1] != '/': + parsed_path += '/' + path = '%sv2/%s' % (parsed_path, account) headers = {'X-Auth-Admin-User': options.admin_user, 'X-Auth-Admin-Key': options.admin_key} conn = http_connect(parsed.hostname, parsed.port, 'DELETE', path, headers, diff --git a/bin/swauth-delete-user b/bin/swauth-delete-user index ede076dd5b..f2f7808b64 100755 --- a/bin/swauth-delete-user +++ b/bin/swauth-delete-user @@ -45,11 +45,12 @@ if __name__ == '__main__': if parsed.scheme not in ('http', 'https'): raise Exception('Cannot handle protocol scheme %s for url %s' % (parsed.scheme, repr(options.admin_url))) - if not parsed.path: - parsed.path = '/' - elif parsed.path[-1] != '/': - parsed.path += '/' - path = '%sv2/%s/%s' % (parsed.path, account, user) + parsed_path = parsed.path + if not parsed_path: + parsed_path = '/' + elif parsed_path[-1] != '/': + parsed_path += '/' + path = '%sv2/%s/%s' % (parsed_path, account, user) headers = {'X-Auth-Admin-User': options.admin_user, 'X-Auth-Admin-Key': options.admin_key} conn = http_connect(parsed.hostname, parsed.port, 'DELETE', path, headers, diff --git a/bin/swauth-list b/bin/swauth-list index 85a7633966..217b5baff8 100755 --- a/bin/swauth-list +++ b/bin/swauth-list @@ -64,11 +64,12 @@ If the [user] is '.groups', the active groups for the account will be listed. if parsed.scheme not in ('http', 'https'): raise Exception('Cannot handle protocol scheme %s for url %s' % (parsed.scheme, repr(options.admin_url))) - if not parsed.path: - parsed.path = '/' - elif parsed.path[-1] != '/': - parsed.path += '/' - path = '%sv2/%s' % (parsed.path, '/'.join(args)) + parsed_path = parsed.path + if not parsed_path: + parsed_path = '/' + elif parsed_path[-1] != '/': + parsed_path += '/' + path = '%sv2/%s' % (parsed_path, '/'.join(args)) headers = {'X-Auth-Admin-User': options.admin_user, 'X-Auth-Admin-Key': options.admin_key} conn = http_connect(parsed.hostname, parsed.port, 'GET', path, headers, diff --git a/bin/swauth-prep b/bin/swauth-prep index 3d2cb7d3eb..ca47ff9faa 100755 --- a/bin/swauth-prep +++ b/bin/swauth-prep @@ -44,11 +44,12 @@ if __name__ == '__main__': if parsed.scheme not in ('http', 'https'): raise Exception('Cannot handle protocol scheme %s for url %s' % (parsed.scheme, repr(options.admin_url))) - if not parsed.path: - parsed.path = '/' - elif parsed.path[-1] != '/': - parsed.path += '/' - path = '%sv2/.prep' % parsed.path + parsed_path = parsed.path + if not parsed_path: + parsed_path = '/' + elif parsed_path[-1] != '/': + parsed_path += '/' + path = '%sv2/.prep' % parsed_path headers = {'X-Auth-Admin-User': options.admin_user, 'X-Auth-Admin-Key': options.admin_key} conn = http_connect(parsed.hostname, parsed.port, 'POST', path, headers, diff --git a/bin/swauth-set-account-service b/bin/swauth-set-account-service index 054e4cfc4b..538210e497 100755 --- a/bin/swauth-set-account-service +++ b/bin/swauth-set-account-service @@ -55,11 +55,12 @@ Example: %prog -K swauthkey test storage local http://127.0.0.1:8080/v1/AUTH_018 if parsed.scheme not in ('http', 'https'): raise Exception('Cannot handle protocol scheme %s for url %s' % (parsed.scheme, repr(options.admin_url))) - if not parsed.path: - parsed.path = '/' - elif parsed.path[-1] != '/': - parsed.path += '/' - path = '%sv2/%s/.services' % (parsed.path, account) + parsed_path = parsed.path + if not parsed_path: + parsed_path = '/' + elif parsed_path[-1] != '/': + parsed_path += '/' + path = '%sv2/%s/.services' % (parsed_path, account) body = json.dumps({service: {name: url}}) headers = {'Content-Length': str(len(body)), 'X-Auth-Admin-User': options.admin_user,