diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-01-01 18:32:52 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-01-01 18:32:52 +0000 |
commit | 7964073cc7a0a27e07d34dfe95b467e12fc50348 (patch) | |
tree | e7648d8f0499ba9b3527e700c672226d312d0f62 | |
parent | 4bd35f7bdc8b39c66ce8682bb3b9809697104a6e (diff) | |
parent | 16e929eb6a10dbfe49f667b6cd09ff214da797eb (diff) | |
download | python-barbicanclient-7964073cc7a0a27e07d34dfe95b467e12fc50348.tar.gz |
Merge "Rename the command line client to barbican"
-rw-r--r-- | README.md | 18 | ||||
-rw-r--r-- | barbicanclient/barbican.py (renamed from barbicanclient/keep.py) | 4 | ||||
-rw-r--r-- | barbicanclient/test/test_barbican.py (renamed from barbicanclient/test/test_keep.py) | 14 | ||||
-rw-r--r-- | setup.py | 9 |
4 files changed, 23 insertions, 22 deletions
@@ -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>] diff --git a/barbicanclient/keep.py b/barbicanclient/barbican.py index 522ece3..e98a1b7 100644 --- a/barbicanclient/keep.py +++ b/barbicanclient/barbican.py @@ -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() diff --git a/barbicanclient/test/test_keep.py b/barbicanclient/test/test_barbican.py index 0bcdea6..c784ea3 100644 --- a/barbicanclient/test/test_keep.py +++ b/barbicanclient/test/test_barbican.py @@ -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() @@ -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", + ], + }, ) |