Merge ~hloeung/apt-stresstest-charm:master into apt-stresstest-charm:master

Proposed by Haw Loeung
Status: Merged
Approved by: Thomas Cuthbert
Approved revision: 10e7f9d88468d59452962fccac097fec99f3ca5e
Merged at revision: f4c56c089e6ef48b9081e8e0572c9f14c1ad351d
Proposed branch: ~hloeung/apt-stresstest-charm:master
Merge into: apt-stresstest-charm:master
Diff against target: 20 lines (+11/-1)
1 file modified
reactive/apt_stresstest.py (+11/-1)
Reviewer Review Type Date Requested Status
Thomas Cuthbert (community) Approve
Canonical IS Reviewers Pending
Review via email: mp+398213@code.launchpad.net

Commit message

Add showing charm source version/commit in juju status output

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Thomas Cuthbert (tcuthbert) wrote :

LGTM +1

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision f4c56c089e6ef48b9081e8e0572c9f14c1ad351d

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/reactive/apt_stresstest.py b/reactive/apt_stresstest.py
2index 55893ba..31712b1 100644
3--- a/reactive/apt_stresstest.py
4+++ b/reactive/apt_stresstest.py
5@@ -167,4 +167,14 @@ def install_apt_stresstest(exec_relation):
6 os.chown(LOGFILE, uid, gid)
7
8 set_state('apt-stresstest.installed')
9- hookenv.status_set('active', 'apt-stresstest installed.')
10+ revision = ''
11+ if os.path.exists('version'):
12+ with open('version') as f:
13+ line = f.readline().strip()
14+ # We only want the first 8 characters, that's enough to tell
15+ # which version of the charm we're using.
16+ if len(line) > 8:
17+ revision = ' (source version/commit {}…)'.format(line[:8])
18+ else:
19+ revision = ' (source version/commit {})'.format(line)
20+ hookenv.status_set('active', 'Ready{}'.format(revision))

Subscribers

People subscribed via source and target branches