Rename the command line client to barbican
Change-Id: I7695365dd5fe2504f3d267012ac6717790e97541
This commit is contained in:
18
README.md
18
README.md
@@ -2,11 +2,11 @@
|
||||
|
||||
This is a client for the [Barbican](https://github.com/stackforge/barbican)
|
||||
Key Management API. There is a Python library for accessing the API
|
||||
(`barbicanclient` module), and a command-line script (`keep`).
|
||||
(`barbicanclient` module), and a command-line script (`barbican`).
|
||||
|
||||
## Installation
|
||||
|
||||
The client is [pip installable](https://pypi.python.org/pypi/python-barbicanclient) as follows:
|
||||
The client is [pip installable](https://pypi.python.org/pypi/python-barbicanclient) as follows:
|
||||
|
||||
```bash
|
||||
pip install python-barbicanclient
|
||||
@@ -16,22 +16,22 @@ pip install python-barbicanclient
|
||||
The full api is [documented in the wiki](https://github.com/cloudkeep/python-barbicanclient/wiki/Client-Usage).
|
||||
|
||||
|
||||
Here's an example of storing a secret in barbican using the python library
|
||||
Here's an example of storing a secret in barbican using the python library
|
||||
with keystone authentication:
|
||||
```python
|
||||
>>> from barbicanclient.common import auth
|
||||
>>> from barbicanclient import client
|
||||
# We'll use keystone for authentication
|
||||
>>> keystone = auth.KeystoneAuthV2(auth_url='http://keystone-int.cloudkeep.io:5000/v2.0',
|
||||
>>> keystone = auth.KeystoneAuthV2(auth_url='http://keystone-int.cloudkeep.io:5000/v2.0',
|
||||
... username='USER', password='PASSWORD', tenant_name='TENANT')
|
||||
>>> barbican = client.Client(auth_plugin=keystone)
|
||||
# Let's store some sensitive data, Barbican encrypts it and stores it securely in the cloud
|
||||
>>> secret_uri = barbican.secrets.store(name='Self destruction sequence',
|
||||
... payload='the magic words are squeamish ossifrage',
|
||||
>>> secret_uri = barbican.secrets.store(name='Self destruction sequence',
|
||||
... payload='the magic words are squeamish ossifrage',
|
||||
... payload_content_type='text/plain')
|
||||
# Let's look at some properties of a barbican Secret
|
||||
>>> secret = barbican.secrets.get(secret_uri)
|
||||
>>> print(secret.secret_ref)
|
||||
>>> print(secret.secret_ref)
|
||||
u'http://api-01-int.cloudkeep.io:9311/v1/test_tenant/secrets/49496a6d-c674-4384-b208-7cf4988f84ee'
|
||||
>>> print(secret.name)
|
||||
Self destruction sequence
|
||||
@@ -40,11 +40,11 @@ Self destruction sequence
|
||||
the magic words are squeamish ossifrage
|
||||
```
|
||||
|
||||
## keep - Command Line Client
|
||||
## barbican - Command Line Client
|
||||
Command line client configuration and usage is [documented in the wiki](https://github.com/cloudkeep/python-barbicanclient/wiki/Command-Line-Client).
|
||||
|
||||
```
|
||||
usage: keep [-h] [--no-auth | --os-auth-url <auth-url>]
|
||||
usage: barbican [-h] [--no-auth | --os-auth-url <auth-url>]
|
||||
[--os-username <auth-user-name>] [--os-password <auth-password>]
|
||||
[--os-tenant-name <auth-tenant-name>] [--os-tenant-id <tenant-id>]
|
||||
[--endpoint <barbican-url>]
|
||||
|
||||
@@ -24,7 +24,7 @@ from barbicanclient.openstack.common import log as logging
|
||||
logging.setup('barbicanclient')
|
||||
|
||||
|
||||
class Keep:
|
||||
class Barbican:
|
||||
def __init__(self):
|
||||
self.parser = self._get_main_parser()
|
||||
self.subparsers = self.parser.add_subparsers(
|
||||
@@ -340,7 +340,7 @@ class Keep:
|
||||
|
||||
|
||||
def main():
|
||||
k = Keep()
|
||||
k = Barbican()
|
||||
k.execute()
|
||||
|
||||
|
||||
@@ -18,27 +18,27 @@ import os
|
||||
import sys
|
||||
import unittest2 as unittest
|
||||
|
||||
import barbicanclient.keep
|
||||
import barbicanclient.barbican
|
||||
|
||||
|
||||
def suite():
|
||||
suite = unittest.TestSuite()
|
||||
|
||||
suite.addTest(TestKeep())
|
||||
suite.addTest(TestBarbican())
|
||||
|
||||
return suite
|
||||
|
||||
|
||||
class TestKeep(unittest.TestCase):
|
||||
def keep(self, argstr):
|
||||
class TestBarbican(unittest.TestCase):
|
||||
def barbican(self, argstr):
|
||||
"""Source: Keystone client's shell method in test_shell.py"""
|
||||
orig = sys.stdout
|
||||
clean_env = {}
|
||||
_old_env, os.environ = os.environ, clean_env.copy()
|
||||
try:
|
||||
sys.stdout = cStringIO.StringIO()
|
||||
_keep = barbicanclient.keep.Keep()
|
||||
_keep.execute(argv=argstr.split())
|
||||
_barbican = barbicanclient.barbican.Barbican()
|
||||
_barbican.execute(argv=argstr.split())
|
||||
except SystemExit:
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
self.assertEqual(exc_value.code, 0)
|
||||
@@ -54,7 +54,7 @@ class TestKeep(unittest.TestCase):
|
||||
|
||||
def test_help(self):
|
||||
args = "-h"
|
||||
self.assertIn('usage: ', self.keep(args))
|
||||
self.assertIn('usage: ', self.barbican(args))
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
9
setup.py
9
setup.py
@@ -71,8 +71,9 @@ setuptools.setup(
|
||||
'Programming Language :: Python :: 2.7',
|
||||
'Environment :: No Input/Output (Daemon)',
|
||||
],
|
||||
entry_points="""
|
||||
[console_scripts]
|
||||
keep = barbicanclient.keep:main
|
||||
"""
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"barbican = barbicanclient.barbican:main",
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user