summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChad Miller <millchad@amazon.com>2019-04-23 17:07:39 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-04-23 17:07:39 +0000
commit3fb55ea85139f2d29ce32f124d099419fbd06f60 (patch)
tree63f926a8a0271ffbb0181f733b109250b2f84d27 /tools
parent5de83fc54c17b504842a924e7db08e8c2c1cebf9 (diff)
downloadvyos-cloud-init-3fb55ea85139f2d29ce32f124d099419fbd06f60.tar.gz
vyos-cloud-init-3fb55ea85139f2d29ce32f124d099419fbd06f60.zip
tools/read-version: handle errors
When the cloned branch was not the canonical upstream and tags were not available, tox would fail because tools/read-version would fail, and tragically never print the advice that is in tools/read-version about how to fix it. This changes tools/read-version to catch the exception that is elsewhere explicitly thrown and treat that too as an error it can handle.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/read-version7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/read-version b/tools/read-version
index e69c2ce0..6dca659e 100755
--- a/tools/read-version
+++ b/tools/read-version
@@ -71,9 +71,12 @@ if is_gitdir(_tdir) and which("git"):
flags = ['--tags']
cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags
- version = tiny_p(cmd).strip()
+ try:
+ version = tiny_p(cmd).strip()
+ except RuntimeError:
+ version = None
- if not version.startswith(src_version):
+ if version is None or not version.startswith(src_version):
sys.stderr.write("git describe version (%s) differs from "
"cloudinit.version (%s)\n" % (version, src_version))
sys.stderr.write(