fix a logic error that results in undefined variable being used

Change-Id: If3c5eca268220e8af5aa7dddbf0df7c05b873589
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-03-18 16:40:53 -04:00
parent 54dc431171
commit 23e7562272

View File

@ -28,9 +28,9 @@ def validate_version(versionstr):
semver = pbr.version.SemanticVersion.from_pip_string(versionstr)
except ValueError as err:
yield 'Invalid version: %s' % err
# Make sure pbr didn't change the version to meet the canonical form.
canonical = semver.release_string()
if canonical != versionstr:
yield 'Version %r does not match canonical form %r' % \
(versionstr, canonical)
else:
# Make sure pbr didn't change the version to meet the canonical form.
canonical = semver.release_string()
if canonical != versionstr:
yield 'Version %r does not match canonical form %r' % \
(versionstr, canonical)