From 16e929eb6a10dbfe49f667b6cd09ff214da797eb Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Mon, 30 Dec 2013 11:44:25 -0500 Subject: [PATCH] Rename the command line client to barbican Change-Id: I7695365dd5fe2504f3d267012ac6717790e97541 --- README.md | 18 +++++++++--------- barbicanclient/{keep.py => barbican.py} | 4 ++-- .../test/{test_keep.py => test_barbican.py} | 14 +++++++------- setup.py | 9 +++++---- 4 files changed, 23 insertions(+), 22 deletions(-) rename barbicanclient/{keep.py => barbican.py} (99%) rename barbicanclient/test/{test_keep.py => test_barbican.py} (82%) diff --git a/README.md b/README.md index 31ba7cbd..0012ee6a 100644 --- a/README.md +++ b/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 ] +usage: barbican [-h] [--no-auth | --os-auth-url ] [--os-username ] [--os-password ] [--os-tenant-name ] [--os-tenant-id ] [--endpoint ] diff --git a/barbicanclient/keep.py b/barbicanclient/barbican.py similarity index 99% rename from barbicanclient/keep.py rename to barbicanclient/barbican.py index 522ece3a..e98a1b72 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 similarity index 82% rename from barbicanclient/test/test_keep.py rename to barbicanclient/test/test_barbican.py index 0bcdea66..c784ea34 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() diff --git a/setup.py b/setup.py index 5216064f..5e4fe760 100644 --- a/setup.py +++ b/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", + ], + }, )