Skip to content

Instantly share code, notes, and snippets.

@brk3
Created July 13, 2017 14:16
Show Gist options
  • Save brk3/17b52b5e71be4914cac22edfc35c2f9a to your computer and use it in GitHub Desktop.
Save brk3/17b52b5e71be4914cac22edfc35c2f9a to your computer and use it in GitHub Desktop.
from castellan import options as castellan_opts
from castellan.common.objects import passphrase
from castellan import key_manager
from castellan import options
from castellan.common import utils
from keystoneauth1 import identity
from keystoneauth1 import session
from oslo_config import cfg
from oslo_context import context
# auth = identity.V3Password(auth_url='http://192.169.5.254:5000/v3',
# username='admin',
# user_domain_name='Default',
# password='password',
# project_name='admin',
# project_domain_name='Default')
# sess = session.Session(auth=auth)
# ctxt = context.RequestContext(auth_token=auth.get_token(sess),
# tenant=auth.get_project_id(sess))
CONF = cfg.CONF
CONF(default_config_files=['~/castellan.conf'])
context = utils.credential_factory(conf=cfg.CONF)
key = passphrase.Passphrase('super_secret_password')
manager = key_manager.API()
stored_key_id = manager.store(context, key)
# manager.delete(context, stored_key_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment