From 04552424c85a9042f69cc1ff35903cda75327157 Mon Sep 17 00:00:00 2001 From: ahothan Date: Tue, 5 Sep 2017 08:39:57 -0700 Subject: [PATCH] Fix bug/1715127 kb_start_server fails on import error https://bugs.launchpad.net/kloudbuster/+bug/1715127 Fix circular dependency between kloudbuster.py and kb_config.py by moving the version string to __init__.py Change-Id: I973d6fa87653e26f5d0cc1661df7b7014b11a2f6 --- kloudbuster/__init__.py | 16 ++++++++++++++++ kloudbuster/kb_config.py | 4 ++-- kloudbuster/kloudbuster.py | 5 ++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/kloudbuster/__init__.py b/kloudbuster/__init__.py index e69de29..2c962f2 100644 --- a/kloudbuster/__init__.py +++ b/kloudbuster/__init__.py @@ -0,0 +1,16 @@ +# Copyright 2017 Cisco Systems, Inc. All rights reserved. +# +# 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 pbr.version + +__version__ = pbr.version.VersionInfo('kloudbuster').version_string_with_vcs() diff --git a/kloudbuster/kb_config.py b/kloudbuster/kb_config.py index 94328c3..10b2164 100644 --- a/kloudbuster/kb_config.py +++ b/kloudbuster/kb_config.py @@ -16,13 +16,13 @@ import os import sys import yaml +from __init__ import __version__ from attrdict import AttrDict import log as logging from oslo_config import cfg from pkg_resources import resource_string import credentials -import kloudbuster CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -114,7 +114,7 @@ class KBConfig(object): # Use the default image name for Glance # defaults to something like "kloudbuster-7.0.0" - default_image_name = 'kloudbuster-' + kloudbuster.__version__ + default_image_name = 'kloudbuster-' + __version__ if not self.config_scale['image_name']: self.config_scale['image_name'] = default_image_name diff --git a/kloudbuster/kloudbuster.py b/kloudbuster/kloudbuster.py index 059bf7f..49849c4 100755 --- a/kloudbuster/kloudbuster.py +++ b/kloudbuster/kloudbuster.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +from __init__ import __version__ + from concurrent.futures import ThreadPoolExecutor import datetime import json @@ -43,7 +45,6 @@ import log as logging from neutronclient.neutron import client as neutronclient from novaclient import client as novaclient from oslo_config import cfg -import pbr.version from pkg_resources import resource_filename from pkg_resources import resource_string from tabulate import tabulate @@ -51,8 +52,6 @@ import tenant CONF = cfg.CONF LOG = logging.getLogger(__name__) -__version__ = pbr.version.VersionInfo('kloudbuster').version_string_with_vcs() - class KBVMCreationException(Exception): pass