Fix for incorrect use of urlparse results in swauth bins
This commit is contained in:
parent
48a00406aa
commit
c89f090cf4
@ -51,11 +51,12 @@ if __name__ == '__main__':
|
|||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
(parsed.scheme, repr(options.admin_url)))
|
(parsed.scheme, repr(options.admin_url)))
|
||||||
if not parsed.path:
|
parsed_path = parsed.path
|
||||||
parsed.path = '/'
|
if not parsed_path:
|
||||||
elif parsed.path[-1] != '/':
|
parsed_path = '/'
|
||||||
parsed.path += '/'
|
elif parsed_path[-1] != '/':
|
||||||
path = '%sv2/%s' % (parsed.path, account)
|
parsed_path += '/'
|
||||||
|
path = '%sv2/%s' % (parsed_path, account)
|
||||||
headers = {'X-Auth-Admin-User': options.admin_user,
|
headers = {'X-Auth-Admin-User': options.admin_user,
|
||||||
'X-Auth-Admin-Key': options.admin_key}
|
'X-Auth-Admin-Key': options.admin_key}
|
||||||
if options.suffix:
|
if options.suffix:
|
||||||
|
@ -61,12 +61,13 @@ if __name__ == '__main__':
|
|||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
(parsed.scheme, repr(options.admin_url)))
|
(parsed.scheme, repr(options.admin_url)))
|
||||||
if not parsed.path:
|
parsed_path = parsed.path
|
||||||
parsed.path = '/'
|
if not parsed_path:
|
||||||
elif parsed.path[-1] != '/':
|
parsed_path = '/'
|
||||||
parsed.path += '/'
|
elif parsed_path[-1] != '/':
|
||||||
|
parsed_path += '/'
|
||||||
# Ensure the account exists
|
# Ensure the account exists
|
||||||
path = '%sv2/%s' % (parsed.path, account)
|
path = '%sv2/%s' % (parsed_path, account)
|
||||||
headers = {'X-Auth-Admin-User': options.admin_user,
|
headers = {'X-Auth-Admin-User': options.admin_user,
|
||||||
'X-Auth-Admin-Key': options.admin_key}
|
'X-Auth-Admin-Key': options.admin_key}
|
||||||
if options.suffix:
|
if options.suffix:
|
||||||
@ -77,7 +78,7 @@ if __name__ == '__main__':
|
|||||||
if resp.status // 100 != 2:
|
if resp.status // 100 != 2:
|
||||||
print 'Account creation failed: %s %s' % (resp.status, resp.reason)
|
print 'Account creation failed: %s %s' % (resp.status, resp.reason)
|
||||||
# Add the user
|
# 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,
|
headers = {'X-Auth-Admin-User': options.admin_user,
|
||||||
'X-Auth-Admin-Key': options.admin_key,
|
'X-Auth-Admin-Key': options.admin_key,
|
||||||
'X-Auth-User-Key': password}
|
'X-Auth-User-Key': password}
|
||||||
|
@ -45,11 +45,12 @@ if __name__ == '__main__':
|
|||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
(parsed.scheme, repr(options.admin_url)))
|
(parsed.scheme, repr(options.admin_url)))
|
||||||
if not parsed.path:
|
parsed_path = parsed.path
|
||||||
parsed.path = '/'
|
if not parsed_path:
|
||||||
elif parsed.path[-1] != '/':
|
parsed_path = '/'
|
||||||
parsed.path += '/'
|
elif parsed_path[-1] != '/':
|
||||||
path = '%sv2/%s' % (parsed.path, account)
|
parsed_path += '/'
|
||||||
|
path = '%sv2/%s' % (parsed_path, account)
|
||||||
headers = {'X-Auth-Admin-User': options.admin_user,
|
headers = {'X-Auth-Admin-User': options.admin_user,
|
||||||
'X-Auth-Admin-Key': options.admin_key}
|
'X-Auth-Admin-Key': options.admin_key}
|
||||||
conn = http_connect(parsed.hostname, parsed.port, 'DELETE', path, headers,
|
conn = http_connect(parsed.hostname, parsed.port, 'DELETE', path, headers,
|
||||||
|
@ -45,11 +45,12 @@ if __name__ == '__main__':
|
|||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
(parsed.scheme, repr(options.admin_url)))
|
(parsed.scheme, repr(options.admin_url)))
|
||||||
if not parsed.path:
|
parsed_path = parsed.path
|
||||||
parsed.path = '/'
|
if not parsed_path:
|
||||||
elif parsed.path[-1] != '/':
|
parsed_path = '/'
|
||||||
parsed.path += '/'
|
elif parsed_path[-1] != '/':
|
||||||
path = '%sv2/%s/%s' % (parsed.path, account, user)
|
parsed_path += '/'
|
||||||
|
path = '%sv2/%s/%s' % (parsed_path, account, user)
|
||||||
headers = {'X-Auth-Admin-User': options.admin_user,
|
headers = {'X-Auth-Admin-User': options.admin_user,
|
||||||
'X-Auth-Admin-Key': options.admin_key}
|
'X-Auth-Admin-Key': options.admin_key}
|
||||||
conn = http_connect(parsed.hostname, parsed.port, 'DELETE', path, headers,
|
conn = http_connect(parsed.hostname, parsed.port, 'DELETE', path, headers,
|
||||||
|
@ -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'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
(parsed.scheme, repr(options.admin_url)))
|
(parsed.scheme, repr(options.admin_url)))
|
||||||
if not parsed.path:
|
parsed_path = parsed.path
|
||||||
parsed.path = '/'
|
if not parsed_path:
|
||||||
elif parsed.path[-1] != '/':
|
parsed_path = '/'
|
||||||
parsed.path += '/'
|
elif parsed_path[-1] != '/':
|
||||||
path = '%sv2/%s' % (parsed.path, '/'.join(args))
|
parsed_path += '/'
|
||||||
|
path = '%sv2/%s' % (parsed_path, '/'.join(args))
|
||||||
headers = {'X-Auth-Admin-User': options.admin_user,
|
headers = {'X-Auth-Admin-User': options.admin_user,
|
||||||
'X-Auth-Admin-Key': options.admin_key}
|
'X-Auth-Admin-Key': options.admin_key}
|
||||||
conn = http_connect(parsed.hostname, parsed.port, 'GET', path, headers,
|
conn = http_connect(parsed.hostname, parsed.port, 'GET', path, headers,
|
||||||
|
@ -44,11 +44,12 @@ if __name__ == '__main__':
|
|||||||
if parsed.scheme not in ('http', 'https'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
(parsed.scheme, repr(options.admin_url)))
|
(parsed.scheme, repr(options.admin_url)))
|
||||||
if not parsed.path:
|
parsed_path = parsed.path
|
||||||
parsed.path = '/'
|
if not parsed_path:
|
||||||
elif parsed.path[-1] != '/':
|
parsed_path = '/'
|
||||||
parsed.path += '/'
|
elif parsed_path[-1] != '/':
|
||||||
path = '%sv2/.prep' % parsed.path
|
parsed_path += '/'
|
||||||
|
path = '%sv2/.prep' % parsed_path
|
||||||
headers = {'X-Auth-Admin-User': options.admin_user,
|
headers = {'X-Auth-Admin-User': options.admin_user,
|
||||||
'X-Auth-Admin-Key': options.admin_key}
|
'X-Auth-Admin-Key': options.admin_key}
|
||||||
conn = http_connect(parsed.hostname, parsed.port, 'POST', path, headers,
|
conn = http_connect(parsed.hostname, parsed.port, 'POST', path, headers,
|
||||||
|
@ -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'):
|
if parsed.scheme not in ('http', 'https'):
|
||||||
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
raise Exception('Cannot handle protocol scheme %s for url %s' %
|
||||||
(parsed.scheme, repr(options.admin_url)))
|
(parsed.scheme, repr(options.admin_url)))
|
||||||
if not parsed.path:
|
parsed_path = parsed.path
|
||||||
parsed.path = '/'
|
if not parsed_path:
|
||||||
elif parsed.path[-1] != '/':
|
parsed_path = '/'
|
||||||
parsed.path += '/'
|
elif parsed_path[-1] != '/':
|
||||||
path = '%sv2/%s/.services' % (parsed.path, account)
|
parsed_path += '/'
|
||||||
|
path = '%sv2/%s/.services' % (parsed_path, account)
|
||||||
body = json.dumps({service: {name: url}})
|
body = json.dumps({service: {name: url}})
|
||||||
headers = {'Content-Length': str(len(body)),
|
headers = {'Content-Length': str(len(body)),
|
||||||
'X-Auth-Admin-User': options.admin_user,
|
'X-Auth-Admin-User': options.admin_user,
|
||||||
|
Loading…
Reference in New Issue
Block a user