~ajkavanagh/+junk/useful-things

« back to all changes in this revision

Viewing changes to charm-manual-testing/manila/v3_keystone/secret-store.py

  • Committer: Alex Kavanagh
  • Date: 2016-12-01 17:01:49 UTC
  • Revision ID: alex.kavanagh@canonical.com-20161201170149-ytewr1hw7z2xre8o
Added serverstack.yaml for juju & manila testing scripts

Note that the manila testing scripts are for serverstack ONLY.
There's a different github repo for manual testing of
manila.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
from keystoneclient.auth import identity
 
3
from keystoneclient import session
 
4
from barbicanclient import client
 
5
import subprocess
 
6
 
 
7
keystone_ip = (subprocess
 
8
               .check_output(['juju-deployer', '-f', 'keystone'])
 
9
               .rstrip())
 
10
barbican_ip = (subprocess
 
11
               .check_output(['juju-deployer', '-f', 'barbican'])
 
12
               .rstrip())
 
13
auth = identity.v3.Password(user_domain_name='default',
 
14
                            username='demo',
 
15
                            password='pass',
 
16
                            project_domain_name='default',
 
17
                            project_name='demo',
 
18
                            auth_url='http://{}:5000/v3'.format(keystone_ip))
 
19
 
 
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')
 
26
secret.store()
 
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)