def _container_creator(storage_url, token, container): http_conn = client.http_connection(storage_url) try: client.head_container(storage_url, token, container, http_conn=http_conn) except client.ClientException: client.put_container(storage_url, token, container, http_conn=http_conn)
def _container_creator(storage_urls, token, container, policy=None): put_headers = None if policy is None else {'x-storage-policy': policy} storage_url = random.choice(storage_urls) http_conn = client.http_connection(storage_url) try: client.head_container(storage_url, token, container, http_conn=http_conn) except client.ClientException: client.put_container(storage_url, token, container, headers=put_headers, http_conn=http_conn)
def _container_creator(storage_urls, token, container): storage_url = random.choice(storage_urls) http_conn = client.http_connection(storage_url) try: client.head_container(storage_url, token, container, http_conn=http_conn) except client.ClientException: client.put_container(storage_url, token, container, http_conn=http_conn)