From: Andrew Schoen Date: Tue, 16 Oct 2018 15:20:54 +0000 (-0500) Subject: validate: check the version of python-notario X-Git-Tag: v3.2.0beta7~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a439eb574d33681bf0e9761fb649c5dbddd2c662;p=ceph-ansible.git validate: check the version of python-notario If the version of python-notario is < 0.0.13 an error message is given like "TypeError: validate() got an unexpected keyword argument 'defined_keys'", which is not helpful in figuring out you've got an incorrect version of python-notario. This check will avoid that situation by telling the user that they need to upgrade python-notario before they hit that error. Signed-off-by: Andrew Schoen --- diff --git a/plugins/actions/validate.py b/plugins/actions/validate.py index 12667404e..5cedd83e7 100644 --- a/plugins/actions/validate.py +++ b/plugins/actions/validate.py @@ -1,5 +1,6 @@ from ansible.plugins.action import ActionBase +from distutils.version import LooseVersion try: from __main__ import display @@ -14,6 +15,11 @@ except ImportError: display.error(msg) raise SystemExit(msg) +if LooseVersion(notario.__version__) < LooseVersion("0.0.13"): + msg = "The python-notario libary has an incompatible version. Version >= 0.0.13 is needed, current version: %s" % notario.__version__ + display.error(msg) + raise SystemExit(msg) + from notario.exceptions import Invalid from notario.validators import types, chainable, iterables from notario.decorators import optional