Skip to content

Instantly share code, notes, and snippets.

@jamielennox
Created February 17, 2015 02:11
Show Gist options
  • Save jamielennox/3b26bfb8e80fa48133e9 to your computer and use it in GitHub Desktop.
Save jamielennox/3b26bfb8e80fa48133e9 to your computer and use it in GitHub Desktop.
Load an auth plugin and session from options in a config file.
import sys
from keystoneclient import auth
from keystoneclient import session
from oslo.config import cfg
cfg.CONF(sys.argv[1:])
auth.register_conf_options(cfg.CONF, 'somegroup')
session.Session.register_conf_options(cfg.CONF, 'somegroup')
plugin = auth.load_from_conf_options(cfg.CONF, 'somegroup')
sess = session.Session.load_from_conf_options(cfg.CONF,
'somegroup',
auth=plugin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment