Check required Gnocchi version is installed

Change-Id: I301511279c1d49736027e51274c8740935e154b0
This commit is contained in:
Mehdi Abaakouk 2017-12-11 08:51:27 +01:00
parent 24a0b74ee6
commit 02c99b1867
2 changed files with 13 additions and 1 deletions

View File

@ -11,6 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from distutils import version
from gnocchiclient import client
from gnocchiclient import exceptions as gnocchi_exc
import keystoneauth1.session
@ -184,9 +186,19 @@ resources_update_operations = [
}]},
]
# NOTE(sileht): We use LooseVersion because pbr can generate invalid
# StrictVersion like 9.0.1.dev226
REQUIRED_VERSION = version.LooseVersion("4.0.0")
def upgrade_resource_types(conf):
gnocchi = get_gnocchiclient(conf)
gnocchi_version = version.LooseVersion(gnocchi.build.get())
if gnocchi_version < REQUIRED_VERSION:
raise Exception("required gnocchi version is %s, got %s",
REQUIRED_VERSION, gnocchi_version)
for name, attributes in resources_initial.items():
try:
gnocchi.resource_type.get(name=name)

View File

@ -33,7 +33,7 @@ data_files =
[extras]
gnocchi =
oslo.cache>=1.5.0 # Apache-2.0
gnocchiclient>=4.0.0 # Apache-2.0
gnocchiclient>=7.0.0 # Apache-2.0
zaqar =
python-zaqarclient>=1.0.0 # Apache-2.0