diff --git a/HACKING.rst b/HACKING.rst index f61b497..3df782f 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -1,12 +1,12 @@ -Climate Style Commandments -========================== +Blazar Style Commandments +========================= - Step 1: Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ - Step 2: Read on -Climate Specific Commandments ------------------------------ +Blazar Specific Commandments +---------------------------- None so far diff --git a/README.rst b/README.rst index 6adf513..45ad55e 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ -============== -Climate client -============== +============= +Blazar client +============= -**Climate client** provides possibility to use *Climate* API(s). +**Blazar client** provides possibility to use *Blazar* API(s). diff --git a/climateclient/v1/__init__.py b/blazarclient/__init__.py similarity index 100% rename from climateclient/v1/__init__.py rename to blazarclient/__init__.py diff --git a/climateclient/base.py b/blazarclient/base.py similarity index 81% rename from climateclient/base.py rename to blazarclient/base.py index 1df1b89..1c3b61b 100644 --- a/climateclient/base.py +++ b/blazarclient/base.py @@ -18,8 +18,8 @@ import json import requests -from climateclient import exception -from climateclient.i18n import _ +from blazarclient import exception +from blazarclient.i18n import _ class BaseClientManager(object): @@ -28,16 +28,16 @@ class BaseClientManager(object): There are environments, nodes and jobs types of API requests. Manager provides CRUD operations for them. """ - def __init__(self, climate_url, auth_token): - self.climate_url = climate_url + def __init__(self, blazar_url, auth_token): + self.blazar_url = blazar_url self.auth_token = auth_token - USER_AGENT = 'python-climateclient' + USER_AGENT = 'python-blazarclient' def _get(self, url, response_key): - """Sends get request to Climate. + """Sends get request to Blazar. - :param url: URL to the wanted Climate resource. + :param url: URL to the wanted Blazar resource. :type url: str :param response_key: Type of resource (environment, node, job). @@ -50,9 +50,9 @@ class BaseClientManager(object): return body[response_key] def _create(self, url, body, response_key): - """Sends create request to Climate. + """Sends create request to Blazar. - :param url: URL to the wanted Climate resource. + :param url: URL to the wanted Blazar resource. :type url: str :param body: Values resource to be created from. @@ -68,17 +68,17 @@ class BaseClientManager(object): return body[response_key] def _delete(self, url): - """Sends delete request to Climate. + """Sends delete request to Blazar. - :param url: URL to the wanted Climate resource. + :param url: URL to the wanted Blazar resource. :type url: str """ resp, body = self.request(url, 'DELETE') def _update(self, url, body, response_key=None): - """Sends update request to Climate. + """Sends update request to Blazar. - :param url: URL to the wanted Climate resource. + :param url: URL to the wanted Blazar resource. :type url: str :param body: Values resource to be updated from. @@ -117,7 +117,7 @@ class BaseClientManager(object): kwargs['data'] = json.dumps(kwargs['body']) del kwargs['body'] - resp = requests.request(method, self.climate_url + url, **kwargs) + resp = requests.request(method, self.blazar_url + url, **kwargs) try: body = json.loads(resp.text) @@ -131,6 +131,6 @@ class BaseClientManager(object): error_message = resp.text body = _("ERROR: {0}").format(error_message) - raise exception.ClimateClientException(body, code=resp.status_code) + raise exception.BlazarClientException(body, code=resp.status_code) return resp, body diff --git a/climateclient/client.py b/blazarclient/client.py similarity index 87% rename from climateclient/client.py rename to blazarclient/client.py index c2a79d5..120df5e 100644 --- a/climateclient/client.py +++ b/blazarclient/client.py @@ -15,14 +15,14 @@ from oslo_utils import importutils -from climateclient import exception -from climateclient.i18n import _ +from blazarclient import exception +from blazarclient.i18n import _ def Client(version=1, *args, **kwargs): version_map = { - '1': 'climateclient.v1.client.Client', - '1a0': 'climateclient.v1.client.Client', + '1': 'blazarclient.v1.client.Client', + '1a0': 'blazarclient.v1.client.Client', } try: client_path = version_map[str(version)] diff --git a/climateclient/command.py b/blazarclient/command.py similarity index 85% rename from climateclient/command.py rename to blazarclient/command.py index e9ac317..0ed7b00 100644 --- a/climateclient/command.py +++ b/blazarclient/command.py @@ -23,8 +23,8 @@ from cliff.formatters import table from cliff import lister from cliff import show -from climateclient import exception -from climateclient import utils +from blazarclient import exception +from blazarclient import utils class OpenStackCommand(command.Command): @@ -56,18 +56,18 @@ class TableFormatter(table.TableFormatter): stdout.write('\n') -class ClimateCommand(OpenStackCommand): +class BlazarCommand(OpenStackCommand): - """Base Climate CLI command.""" + """Base Blazar CLI command.""" api = 'reservation' - log = logging.getLogger(__name__ + '.ClimateCommand') + log = logging.getLogger(__name__ + '.BlazarCommand') values_specs = [] json_indent = None resource = None allow_names = True def __init__(self, app, app_args): - super(ClimateCommand, self).__init__(app, app_args) + super(BlazarCommand, self).__init__(app, app_args) # NOTE(dbelova): This is no longer supported in cliff version 1.5.2 # the same moment occurred in Neutron: @@ -80,7 +80,7 @@ class ClimateCommand(OpenStackCommand): return self.app.client def get_parser(self, prog_name): - parser = super(ClimateCommand, self).get_parser(prog_name) + parser = super(BlazarCommand, self).get_parser(prog_name) return parser def format_output_data(self, data): @@ -115,7 +115,7 @@ class ClimateCommand(OpenStackCommand): return {} -class CreateCommand(ClimateCommand, show.ShowOne): +class CreateCommand(BlazarCommand, show.ShowOne): """Create resource with passed args.""" api = 'reservation' @@ -124,9 +124,9 @@ class CreateCommand(ClimateCommand, show.ShowOne): def get_data(self, parsed_args): self.log.debug('get_data(%s)' % parsed_args) - climate_client = self.get_client() + blazar_client = self.get_client() body = self.args2body(parsed_args) - resource_manager = getattr(climate_client, self.resource) + resource_manager = getattr(blazar_client, self.resource) data = resource_manager.create(**body) self.format_output_data(data) @@ -137,7 +137,7 @@ class CreateCommand(ClimateCommand, show.ShowOne): return zip(*sorted(six.iteritems(data))) -class UpdateCommand(ClimateCommand): +class UpdateCommand(BlazarCommand): """Update resource's information.""" api = 'reservation' @@ -159,22 +159,22 @@ class UpdateCommand(ClimateCommand): def run(self, parsed_args): self.log.debug('run(%s)' % parsed_args) - climate_client = self.get_client() + blazar_client = self.get_client() body = self.args2body(parsed_args) if self.allow_names: - res_id = utils.find_resource_id_by_name_or_id(climate_client, + res_id = utils.find_resource_id_by_name_or_id(blazar_client, self.resource, parsed_args.id) else: res_id = parsed_args.id - resource_manager = getattr(climate_client, self.resource) + resource_manager = getattr(blazar_client, self.resource) resource_manager.update(res_id, **body) print(self.app.stdout, 'Updated %s: %s' % (self.resource, parsed_args.id)) return -class DeleteCommand(ClimateCommand): +class DeleteCommand(BlazarCommand): """Delete a given resource.""" api = 'reservation' @@ -194,10 +194,10 @@ class DeleteCommand(ClimateCommand): def run(self, parsed_args): self.log.debug('run(%s)' % parsed_args) - climate_client = self.get_client() - resource_manager = getattr(climate_client, self.resource) + blazar_client = self.get_client() + resource_manager = getattr(blazar_client, self.resource) if self.allow_names: - res_id = utils.find_resource_id_by_name_or_id(climate_client, + res_id = utils.find_resource_id_by_name_or_id(blazar_client, self.resource, parsed_args.id) else: @@ -208,7 +208,7 @@ class DeleteCommand(ClimateCommand): return -class ListCommand(ClimateCommand, lister.Lister): +class ListCommand(BlazarCommand, lister.Lister): """List resources that belong to a given tenant.""" api = 'reservation' @@ -225,7 +225,7 @@ class ListCommand(ClimateCommand, lister.Lister): params['sort_by'] = parsed_args.sort_by else: msg = 'Invalid sort option %s' % parsed_args.sort_by - raise exception.ClimateClientException(msg) + raise exception.BlazarClientException(msg) return params def get_parser(self, prog_name): @@ -233,10 +233,10 @@ class ListCommand(ClimateCommand, lister.Lister): return parser def retrieve_list(self, parsed_args): - """Retrieve a list of resources from Climate server""" - climate_client = self.get_client() + """Retrieve a list of resources from Blazar server""" + blazar_client = self.get_client() body = self.args2body(parsed_args) - resource_manager = getattr(climate_client, self.resource) + resource_manager = getattr(blazar_client, self.resource) data = resource_manager.list(**body) return data @@ -260,7 +260,7 @@ class ListCommand(ClimateCommand, lister.Lister): return self.setup_columns(data, parsed_args) -class ShowCommand(ClimateCommand, show.ShowOne): +class ShowCommand(BlazarCommand, show.ShowOne): """Show information of a given resource.""" api = 'reservation' @@ -279,16 +279,16 @@ class ShowCommand(ClimateCommand, show.ShowOne): def get_data(self, parsed_args): self.log.debug('get_data(%s)' % parsed_args) - climate_client = self.get_client() + blazar_client = self.get_client() if self.allow_names: - res_id = utils.find_resource_id_by_name_or_id(climate_client, + res_id = utils.find_resource_id_by_name_or_id(blazar_client, self.resource, parsed_args.id) else: res_id = parsed_args.id - resource_manager = getattr(climate_client, self.resource) + resource_manager = getattr(blazar_client, self.resource) data = resource_manager.get(res_id) self.format_output_data(data) return zip(*sorted(six.iteritems(data))) diff --git a/climateclient/exception.py b/blazarclient/exception.py similarity index 74% rename from climateclient/exception.py rename to blazarclient/exception.py index bd88f8d..9dd5968 100644 --- a/climateclient/exception.py +++ b/blazarclient/exception.py @@ -14,10 +14,10 @@ # limitations under the License. -from climateclient.i18n import _ +from blazarclient.i18n import _ -class ClimateClientException(Exception): +class BlazarClientException(Exception): """Base exception class.""" message = _("An unknown exception occurred %s.") code = 500 @@ -34,17 +34,17 @@ class ClimateClientException(Exception): if not message: message = self.message % kwargs - super(ClimateClientException, self).__init__(message) + super(BlazarClientException, self).__init__(message) -class CommandError(ClimateClientException): +class CommandError(BlazarClientException): """Occurs if not all authentication vital options are set.""" message = _("You have to provide all options like user name or tenant " "id to make authentication possible.") code = 401 -class NotAuthorized(ClimateClientException): +class NotAuthorized(BlazarClientException): """HTTP 401 - Not authorized. User have no enough rights to perform action. @@ -53,26 +53,26 @@ class NotAuthorized(ClimateClientException): message = _("Not authorized request.") -class NoClimateEndpoint(ClimateClientException): - """Occurs if no endpoint for Climate set in the Keystone.""" - message = _("No publicURL endpoint for Climate found. Set endpoint " - "for Climate in the Keystone.") +class NoBlazarEndpoint(BlazarClientException): + """Occurs if no endpoint for Blazar set in the Keystone.""" + message = _("No publicURL endpoint for Blazar found. Set endpoint " + "for Blazar in the Keystone.") code = 404 -class NoUniqueMatch(ClimateClientException): +class NoUniqueMatch(BlazarClientException): """Occurs if there are more than one appropriate resources.""" message = _("There is no unique requested resource.") code = 409 -class UnsupportedVersion(ClimateClientException): +class UnsupportedVersion(BlazarClientException): """Occurs if unsupported client version was requested.""" message = _("Unsupported client version requested.") code = 406 -class IncorrectLease(ClimateClientException): +class IncorrectLease(BlazarClientException): """Occurs if lease parameters are incorrect.""" message = _("The lease parameters are incorrect.") code = 409 diff --git a/climateclient/i18n.py b/blazarclient/i18n.py similarity index 94% rename from climateclient/i18n.py rename to blazarclient/i18n.py index 07fccce..fc1fb2a 100644 --- a/climateclient/i18n.py +++ b/blazarclient/i18n.py @@ -21,7 +21,7 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html . import oslo_i18n -_translators = oslo_i18n.TranslatorFactory(domain='climateclient') +_translators = oslo_i18n.TranslatorFactory(domain='blazarclient') # The primary translation function using the well-known name "_" _ = _translators.primary diff --git a/climateclient/shell.py b/blazarclient/shell.py similarity index 93% rename from climateclient/shell.py rename to blazarclient/shell.py index 173c789..4a1cfbc 100644 --- a/climateclient/shell.py +++ b/blazarclient/shell.py @@ -14,7 +14,7 @@ # limitations under the License. """ -Command-line interface to the Climate APIs +Command-line interface to the Blazar APIs """ from __future__ import print_function @@ -29,12 +29,12 @@ from keystoneclient import client as keystone_client from keystoneclient import exceptions as keystone_exceptions from oslo_utils import encodeutils -from climateclient import client as climate_client -from climateclient import exception -from climateclient import utils -from climateclient.v1.shell_commands import hosts -from climateclient.v1.shell_commands import leases -from climateclient import version as base_version +from blazarclient import client as blazar_client +from blazarclient import exception +from blazarclient import utils +from blazarclient.v1.shell_commands import hosts +from blazarclient.v1.shell_commands import leases +from blazarclient import version as base_version COMMANDS_V1 = { 'lease-list': leases.ListLeases, @@ -106,17 +106,17 @@ class HelpAction(argparse.Action): sys.exit(0) -class ClimateShell(app.App): - """Manager class for the Climate CLI.""" +class BlazarShell(app.App): + """Manager class for the Blazar CLI.""" CONSOLE_MESSAGE_FORMAT = '%(message)s' DEBUG_MESSAGE_FORMAT = '%(levelname)s: %(name)s %(message)s' log = logging.getLogger(__name__) def __init__(self): - super(ClimateShell, self).__init__( + super(BlazarShell, self).__init__( description=__doc__.strip(), version=VERSION, - command_manager=commandmanager.CommandManager('climate.cli'), ) + command_manager=commandmanager.CommandManager('blazar.cli'), ) self.commands = COMMANDS def build_option_parser(self, description, version, argparse_kwargs=None): @@ -247,8 +247,8 @@ class ClimateShell(app.App): parser.add_argument( '--insecure', action='store_true', - default=env('CLIMATECLIENT_INSECURE', default=False), - help="Explicitly allow climateclient to perform \"insecure\" " + default=env('BLAZARCLIENT_INSECURE', default=False), + help="Explicitly allow blazarclient to perform \"insecure\" " "SSL (https) requests. The server's certificate will " "not be verified against any certificate authorities. " "This option should be used with caution.") @@ -412,18 +412,18 @@ class ClimateShell(app.App): if auth: try: - climate_url = keystone.service_catalog.url_for( + blazar_url = keystone.service_catalog.url_for( service_type='reservation' ) except keystone_exceptions.EndpointNotFound: - raise exception.NoClimateEndpoint() + raise exception.NoBlazarEndpoint() else: raise exception.NotAuthorized("User %s is not authorized." % self.options.os_username) - client = climate_client.Client(self.options.os_reservation_api_version, - climate_url=climate_url, - auth_token=keystone.auth_token) + client = blazar_client.Client(self.options.os_reservation_api_version, + blazar_url=blazar_url, + auth_token=keystone.auth_token) self.client = client return @@ -434,7 +434,7 @@ class ClimateShell(app.App): * validate authentication info """ - super(ClimateShell, self).initialize_app(argv) + super(BlazarShell, self).initialize_app(argv) cmd_name = None if argv: @@ -473,8 +473,8 @@ class ClimateShell(app.App): def main(argv=sys.argv[1:]): try: - return ClimateShell().run(map(encodeutils.safe_decode, argv)) - except exception.ClimateClientException: + return BlazarShell().run(map(encodeutils.safe_decode, argv)) + except exception.BlazarClientException: return 1 except Exception as e: print(unicode(e)) diff --git a/climateclient/tests/__init__.py b/blazarclient/tests/__init__.py similarity index 100% rename from climateclient/tests/__init__.py rename to blazarclient/tests/__init__.py diff --git a/climateclient/tests/test_base.py b/blazarclient/tests/test_base.py similarity index 93% rename from climateclient/tests/test_base.py rename to blazarclient/tests/test_base.py index 0b93e05..e5f6c50 100644 --- a/climateclient/tests/test_base.py +++ b/blazarclient/tests/test_base.py @@ -16,9 +16,9 @@ import requests -from climateclient import base -from climateclient import exception -from climateclient import tests +from blazarclient import base +from blazarclient import exception +from blazarclient import tests class BaseClientManagerTestCase(tests.TestCase): @@ -87,7 +87,7 @@ class BaseClientManagerTestCase(tests.TestCase): kwargs = {"body": {"key": "value"}} - self.assertRaises(exception.ClimateClientException, + self.assertRaises(exception.BlazarClientException, self.manager.request, self.url, "POST", **kwargs) @@ -97,6 +97,6 @@ class BaseClientManagerTestCase(tests.TestCase): kwargs = {"body": "key"} - self.assertRaises(exception.ClimateClientException, + self.assertRaises(exception.BlazarClientException, self.manager.request, self.url, "POST", **kwargs) diff --git a/climateclient/tests/test_client.py b/blazarclient/tests/test_client.py similarity index 86% rename from climateclient/tests/test_client.py rename to blazarclient/tests/test_client.py index cfcd682..2c8cc4e 100644 --- a/climateclient/tests/test_client.py +++ b/blazarclient/tests/test_client.py @@ -15,9 +15,9 @@ from oslo_utils import importutils -from climateclient import client -from climateclient import exception -from climateclient import tests +from blazarclient import client +from blazarclient import exception +from blazarclient import tests class BaseClientTestCase(tests.TestCase): @@ -32,12 +32,12 @@ class BaseClientTestCase(tests.TestCase): def test_with_v1(self): self.client.Client() self.import_obj.assert_called_once_with( - 'climateclient.v1.client.Client') + 'blazarclient.v1.client.Client') def test_with_v1a0(self): self.client.Client(version='1a0') self.import_obj.assert_called_once_with( - 'climateclient.v1.client.Client') + 'blazarclient.v1.client.Client') def test_with_wrong_vers(self): self.assertRaises(exception.UnsupportedVersion, diff --git a/climateclient/tests/test_command.py b/blazarclient/tests/test_command.py similarity index 94% rename from climateclient/tests/test_command.py rename to blazarclient/tests/test_command.py index 9d91496..b6067b5 100644 --- a/climateclient/tests/test_command.py +++ b/blazarclient/tests/test_command.py @@ -16,8 +16,8 @@ import mock import testtools -from climateclient import command -from climateclient import tests +from blazarclient import command +from blazarclient import tests class OpenstackCommandTestCase(tests.TestCase): @@ -48,15 +48,15 @@ class TableFormatterTestCase(tests.TestCase): pass -class ClimateCommandTestCase(tests.TestCase): +class BlazarCommandTestCase(tests.TestCase): def setUp(self): - super(ClimateCommandTestCase, self).setUp() + super(BlazarCommandTestCase, self).setUp() self.app = mock.MagicMock() self.parser = self.patch(command.OpenStackCommand, 'get_parser') - self.command = command.ClimateCommand(self.app, []) + self.command = command.BlazarCommand(self.app, []) def test_get_client(self): client = self.command.get_client() diff --git a/climateclient/tests/test_shell.py b/blazarclient/tests/test_shell.py similarity index 87% rename from climateclient/tests/test_shell.py rename to blazarclient/tests/test_shell.py index 30bdd3f..8e7d1fe 100644 --- a/climateclient/tests/test_shell.py +++ b/blazarclient/tests/test_shell.py @@ -23,10 +23,10 @@ import fixtures import testtools #note(n.s.): you may need it later -#from climateclient import client as climate_client -#from climateclient import exception -from climateclient import shell -from climateclient import tests +#from blazarclient import client as blazar_client +#from blazarclient import exception +from blazarclient import shell +from blazarclient import tests FAKE_ENV = {'OS_USERNAME': 'username', 'OS_PASSWORD': 'password', @@ -34,17 +34,17 @@ FAKE_ENV = {'OS_USERNAME': 'username', 'OS_AUTH_URL': 'http://no.where'} -class ClimateShellTestCase(tests.TestCase): +class BlazarShellTestCase(tests.TestCase): def make_env(self, exclude=None, fake_env=FAKE_ENV): env = dict((k, v) for k, v in fake_env.items() if k != exclude) self.useFixture(fixtures.MonkeyPatch('os.environ', env)) def setUp(self): - super(ClimateShellTestCase, self).setUp() + super(BlazarShellTestCase, self).setUp() #Create shell for non-specific tests - self.climate_shell = shell.ClimateShell() + self.blazar_shell = shell.BlazarShell() def shell(self, argstr, exitcodes=(0,)): orig = sys.stdout @@ -52,7 +52,7 @@ class ClimateShellTestCase(tests.TestCase): try: sys.stdout = six.StringIO() sys.stderr = six.StringIO() - _shell = shell.ClimateShell() + _shell = shell.BlazarShell() _shell.initialize_app(argstr.split()) except SystemExit: exc_type, exc_value, exc_traceback = sys.exc_info() @@ -86,7 +86,7 @@ class ClimateShellTestCase(tests.TestCase): @testtools.skip('lol') def test_authenticate_user(self): - obj = shell.ClimateShell() + obj = shell.BlazarShell() obj.initialize_app('list-leases') obj.options.os_token = 'aaaa-bbbb-cccc' obj.options.os_cacert = 'cert' diff --git a/climateclient/utils.py b/blazarclient/utils.py similarity index 92% rename from climateclient/utils.py rename to blazarclient/utils.py index 8ff047f..b428ff5 100644 --- a/climateclient/utils.py +++ b/blazarclient/utils.py @@ -19,8 +19,8 @@ import os import re import six -from climateclient import exception -from climateclient.i18n import _ +from blazarclient import exception +from blazarclient.i18n import _ HEX_ELEM = '[0-9A-Fa-f]' UUID_PATTERN = '-'.join([HEX_ELEM + '{8}', HEX_ELEM + '{4}', @@ -114,8 +114,8 @@ def find_resource_id_by_name_or_id(client, resource, name_or_id): for resource in resources: if resource['id'] == name_or_id: return name_or_id - raise exception.ClimateClientException('No resource found with ID %s' % - name_or_id) + raise exception.BlazarClientException('No resource found with ID %s' % + name_or_id) return _find_resource_id_by_name(client, resource, name_or_id) @@ -137,8 +137,8 @@ def _find_resource_id_by_name(client, resource, name): return named_resources[0] else: message = "Unable to find resource with name '%s'" % name - raise exception.ClimateClientException(message=message, - status_code=404) + raise exception.BlazarClientException(message=message, + status_code=404) def from_elapsed_time_to_seconds(elapsed_time, pos_sign=True): @@ -150,8 +150,8 @@ def from_elapsed_time_to_seconds(elapsed_time, pos_sign=True): """ is_elapsed_time = re.match(ELAPSED_TIME_REGEX, elapsed_time) if is_elapsed_time is None: - raise exception.ClimateClientException(_("Invalid time " - "format for option.")) + raise exception.BlazarClientException(_("Invalid time " + "format for option.")) elapsed_time_value = int(is_elapsed_time.group(1)) elapsed_time_option = is_elapsed_time.group(2) seconds = { diff --git a/climateclient/v1/shell_commands/__init__.py b/blazarclient/v1/__init__.py similarity index 100% rename from climateclient/v1/shell_commands/__init__.py rename to blazarclient/v1/__init__.py diff --git a/climateclient/v1/client.py b/blazarclient/v1/client.py similarity index 74% rename from climateclient/v1/client.py rename to blazarclient/v1/client.py index c599998..946d78a 100644 --- a/climateclient/v1/client.py +++ b/blazarclient/v1/client.py @@ -14,12 +14,12 @@ # limitations under the License. -from climateclient.v1 import hosts -from climateclient.v1 import leases +from blazarclient.v1 import hosts +from blazarclient.v1 import leases class Client(object): - """Top level object to communicate with Climate. + """Top level object to communicate with Blazar. Contains managers to control requests that should be passed to each type of resources - leases, events, etc. @@ -31,11 +31,11 @@ class Client(object): ... """ - def __init__(self, climate_url, auth_token): - self.climate_url = climate_url + def __init__(self, blazar_url, auth_token): + self.blazar_url = blazar_url self.auth_token = auth_token - self.lease = leases.LeaseClientManager(self.climate_url, + self.lease = leases.LeaseClientManager(self.blazar_url, self.auth_token) - self.host = hosts.ComputeHostClientManager(self.climate_url, + self.host = hosts.ComputeHostClientManager(self.blazar_url, self.auth_token) diff --git a/climateclient/v1/hosts.py b/blazarclient/v1/hosts.py similarity index 96% rename from climateclient/v1/hosts.py rename to blazarclient/v1/hosts.py index f44a979..de6dddd 100644 --- a/climateclient/v1/hosts.py +++ b/blazarclient/v1/hosts.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from climateclient import base -from climateclient.i18n import _ +from blazarclient import base +from blazarclient.i18n import _ class ComputeHostClientManager(base.BaseClientManager): diff --git a/climateclient/v1/leases.py b/blazarclient/v1/leases.py similarity index 96% rename from climateclient/v1/leases.py rename to blazarclient/v1/leases.py index c607aff..084df3d 100644 --- a/climateclient/v1/leases.py +++ b/blazarclient/v1/leases.py @@ -15,9 +15,9 @@ from oslo_utils import timeutils -from climateclient import base -from climateclient.i18n import _ -from climateclient import utils +from blazarclient import base +from blazarclient.i18n import _ +from blazarclient import utils class LeaseClientManager(base.BaseClientManager): diff --git a/blazarclient/v1/shell_commands/__init__.py b/blazarclient/v1/shell_commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/climateclient/v1/shell_commands/hosts.py b/blazarclient/v1/shell_commands/hosts.py similarity index 99% rename from climateclient/v1/shell_commands/hosts.py rename to blazarclient/v1/shell_commands/hosts.py index 8758dde..7aff2df 100644 --- a/climateclient/v1/shell_commands/hosts.py +++ b/blazarclient/v1/shell_commands/hosts.py @@ -15,7 +15,7 @@ import logging -from climateclient import command +from blazarclient import command class ListHosts(command.ListCommand): diff --git a/climateclient/v1/shell_commands/leases.py b/blazarclient/v1/shell_commands/leases.py similarity index 98% rename from climateclient/v1/shell_commands/leases.py rename to blazarclient/v1/shell_commands/leases.py index cf7f673..08a6796 100644 --- a/climateclient/v1/shell_commands/leases.py +++ b/blazarclient/v1/shell_commands/leases.py @@ -18,8 +18,8 @@ import datetime import logging import re -from climateclient import command -from climateclient import exception +from blazarclient import command +from blazarclient import exception class ListLeases(command.ListCommand): @@ -162,7 +162,7 @@ class CreateLease(command.CreateCommand): if not phys_res_info['min'] and not phys_res_info['max']: raise exception.IncorrectLease(err_msg) # NOTE(sbauza): The resource type should be conf-driven mapped with - # climate.conf file but that's potentially on another + # blazar.conf file but that's potentially on another # host phys_res_info['resource_type'] = 'physical:host' physical_reservations.append(phys_res_info) diff --git a/climateclient/version.py b/blazarclient/version.py similarity index 88% rename from climateclient/version.py rename to blazarclient/version.py index 43a56fb..3bd8f7b 100644 --- a/climateclient/version.py +++ b/blazarclient/version.py @@ -16,4 +16,4 @@ import pbr.version -__version__ = pbr.version.VersionInfo('python-climateclient').version_string() +__version__ = pbr.version.VersionInfo('python-blazarclient').version_string() diff --git a/climateclient/__init__.py b/climateclient/__init__.py index e69de29..572dab0 100644 --- a/climateclient/__init__.py +++ b/climateclient/__init__.py @@ -0,0 +1,20 @@ +# Copyright (c) 2017 NTT Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os + +__path__ = [ + os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), + 'blazarclient')] diff --git a/setup.cfg b/setup.cfg index b2c9a13..5fd2f14 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = python-climateclient +name = python-blazarclient summary = Client for OpenStack Reservation Service description-file = README.rst license = Apache Software License @@ -16,18 +16,19 @@ classifiers = Operating System :: POSIX :: Linux author = OpenStack author_email = openstack-dev@lists.openstack.org -home-page = https://launchpad.net/climate +home-page = https://launchpad.net/blazar [global] setup-hooks = pbr.hooks.setup_hook [files] packages = - climateclient + blazarclient [entry_points] console_scripts = - climate = climateclient.shell:main + climate = blazarclient.shell:main + blazar = blazarclient.shell:main [build_sphinx] all_files = 1 diff --git a/tox.ini b/tox.ini index 8efa684..8e66aa5 100644 --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,8 @@ deps = -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt setenv = VIRTUAL_ENV={envdir} BRANCH_NAME=master - CLIENT_NAME=python-climateclient - DISCOVER_DIRECTORY=climateclient/tests + CLIENT_NAME=python-blazarclient + DISCOVER_DIRECTORY=blazarclient/tests commands = python setup.py testr --slowest --testr-args="{posargs}" @@ -24,7 +24,7 @@ ignore = E265,H405 exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg [hacking] -import_exceptions = climateclient.i18n +import_exceptions = blazarclient.i18n [testenv:venv] commands = {posargs}