2
from keystoneclient.auth import identity
3
from keystoneclient import session
4
from barbicanclient import client
7
keystone_ip = (subprocess
8
.check_output(['juju-deployer', '-f', 'keystone'])
10
barbican_ip = (subprocess
11
.check_output(['juju-deployer', '-f', 'barbican'])
13
auth = identity.v3.Password(user_domain_name='default',
16
project_domain_name='default',
18
auth_url='http://{}:5000/v3'.format(keystone_ip))
20
sess = session.Session(auth=auth)
21
barbican = client.Client(session=sess,
22
endpoint='http://{}:9311'.format(barbican_ip))
23
secret = barbican.secrets.create(
24
name='Self destruction sequence',
25
payload='the magic words are squeamish ossifrage')
27
print(secret.secret_ref)
28
ref = secret.secret_ref.replace('localhost', barbican_ip)
29
retrieved_secret = barbican.secrets.get(secret.secret_ref)
30
print(retrieved_secret.payload)