Merge ~hloeung/charm-telegraf:master into charm-telegraf:master

Proposed by Haw Loeung
Status: Merged
Approved by: Haw Loeung
Approved revision: 007ce0a36fcf6e5cb77d15db475bd291e0ce35bd
Merged at revision: dabf651354e26000f980d63f4ffb1bf2e4f71d81
Proposed branch: ~hloeung/charm-telegraf:master
Merge into: charm-telegraf:master
Diff against target: 23 lines (+11/-1)
1 file modified
src/reactive/telegraf.py (+11/-1)
Reviewer Review Type Date Requested Status
Joe Guo (community) Approve
Canonical IS Reviewers Pending
BootStack Reviewers Pending
Review via email: mp+397477@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
Joe Guo (guoqiao) wrote :

LGTM, +1.

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

Change successfully merged at revision dabf651354e26000f980d63f4ffb1bf2e4f71d81

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/reactive/telegraf.py b/src/reactive/telegraf.py
2index c139276..017ad67 100644
3--- a/src/reactive/telegraf.py
4+++ b/src/reactive/telegraf.py
5@@ -1415,7 +1415,17 @@ def start_or_restart():
6 time.sleep(0.1)
7
8 if host.service_running(service):
9- hookenv.status_set("active", "Monitoring {}".format(get_remote_unit_name()))
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", "Monitoring {}{}".format(get_remote_unit_name(), revision))
21 clear_flag("telegraf.needs_reload")
22 else:
23 hookenv.status_set("blocked", "Telegraf failed to start. Check config.")

Subscribers

People subscribed via source and target branches

to all changes: