Skip to content

Instantly share code, notes, and snippets.

@e0ne
Created May 3, 2017 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save e0ne/bf04d763e222a22976c8745dd28970da to your computer and use it in GitHub Desktop.
Save e0ne/bf04d763e222a22976c8745dd28970da to your computer and use it in GitHub Desktop.
python-cinderclient noauth Python API example
#!/usr/bin/python
import os
import brick_cinderclient_ext
from cinderclient import client
from cinderclient.contrib import noauth
from keystoneauth1 import loading
from keystoneauth1 import session
bypass_url = "http://172.29.236.100:8776/v3"
project_id = "cinderflex"
auth_plugin = noauth.CinderNoAuthPlugin('',
project_id,
None,
bypass_url)
loader = loading.get_plugin_loader('noauth')
auth = loader.load_from_options(endpoint=bypass_url,
user_id="foo",
project_id="cinderflex")
sess = session.Session(auth=auth)
c = client.Client(
3,
'password', 'cinderflex', bypass_url,
tenant_id='cinderflex',
bypass_url=bypass_url,
auth_plugin=auth_plugin,
session=sess)
print(c.volumes.list())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment