Merge ~amzn-cmiller/cloud-init:read-version_errors into cloud-init:master

Proposed by Chad
Status: Merged
Approved by: Dan Watkins
Approved revision: 39185f5f7e29d3239ece644bade9a070efc41920
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~amzn-cmiller/cloud-init:read-version_errors
Merge into: cloud-init:master
Diff against target: 19 lines (+5/-2)
1 file modified
tools/read-version (+5/-2)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Review via email: mp+365126@code.launchpad.net

Commit message

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.

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

Chad,

what's the next steps here? I see you've targeted this to someone elses branch. Is there still work or should this be dropped/closed?

Revision history for this message
Ryan Harper (raharper) wrote :

I'm sorry, my mistake Chad. This _is_ your branch, I had a different Chad in my mind.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:39185f5f7e29d3239ece644bade9a070efc41920
https://jenkins.ubuntu.com/server/job/cloud-init-ci/671/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/671/rebuild

review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

Commit message lints:
 - Line #0 has 151 too many characters. Line starts with: "When the cloned branch"... - Line #2 has 62 too many characters. Line starts with: "This changes tools/read-version"...

review: Needs Fixing
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

Commit message lints:
 - Line #2 has 151 too many characters. Line starts with: "When the cloned branch"... - Line #4 has 62 too many characters. Line starts with: "This changes tools/read-version"...

review: Needs Fixing
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tools/read-version b/tools/read-version
2index e69c2ce..6dca659 100755
3--- a/tools/read-version
4+++ b/tools/read-version
5@@ -71,9 +71,12 @@ if is_gitdir(_tdir) and which("git"):
6 flags = ['--tags']
7 cmd = ['git', 'describe', '--abbrev=8', '--match=[0-9]*'] + flags
8
9- version = tiny_p(cmd).strip()
10+ try:
11+ version = tiny_p(cmd).strip()
12+ except RuntimeError:
13+ version = None
14
15- if not version.startswith(src_version):
16+ if version is None or not version.startswith(src_version):
17 sys.stderr.write("git describe version (%s) differs from "
18 "cloudinit.version (%s)\n" % (version, src_version))
19 sys.stderr.write(

Subscribers

People subscribed via source and target branches