Merge ~brettmilford/charm-grafana:lp-1893320 into charm-grafana:master

Proposed by Brett Milford
Status: Merged
Approved by: James Troup
Approved revision: be241b4cd065586fa62f652a3d527a8ac6c99206
Merged at revision: 247b88d3f2a0f1735f5091f560c4c61843778daa
Proposed branch: ~brettmilford/charm-grafana:lp-1893320
Merge into: charm-grafana:master
Diff against target: 48 lines (+18/-13)
1 file modified
src/reactive/grafana.py (+18/-13)
Reviewer Review Type Date Requested Status
Celia Wang Approve
Chris Johnston (community) Approve
Paul Goins Needs Fixing
Review via email: mp+402616@code.launchpad.net

Commit message

Fix LP #1893320

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
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Unable to determine commit message from repository - please click "Set commit message" and enter the commit message manually.

Revision history for this message
Paul Goins (vultaire) wrote :

Hi,

It looks like there are merge issues; reactive/grafana.py is showing diff markers, which I'm guessing are coming from Launchpad. Can you ensure you have the latest sources for the master branch, then re-base this change on top of that?

review: Needs Fixing
Revision history for this message
Brett Milford (brettmilford) wrote :

Hi Paul,
Thanks for your review.
I have now rebased the change off of master and that appears to have fixed the diff markers.

Revision history for this message
Chris Johnston (cjohnston) :
review: Approve
Revision history for this message
Celia Wang (ziyiwang) wrote :

LGTM

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

Change successfully merged at revision 247b88d3f2a0f1735f5091f560c4c61843778daa

Revision history for this message
Joe Guo (guoqiao) wrote :

I confirmed this patch fixed this grafana issue: "Exception reaching prometheus API whilst updating dashboards"

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/reactive/grafana.py b/src/reactive/grafana.py
2index 31c364b..b1869df 100644
3--- a/src/reactive/grafana.py
4+++ b/src/reactive/grafana.py
5@@ -890,9 +890,8 @@ def generate_prometheus_dashboards(gf_adminpasswd, ds):
6 "Exception while trying to reach prometheus API: {}".format(e),
7 "ERROR",
8 )
9- hookenv.status_set(
10- "blocked", "Exception reaching prometheus API whilst updating dashboards"
11- )
12+ hookenv.status_set("blocked", "Exception reaching prometheus API whilst "
13+ "updating dashboards")
14 return
15
16 if response.status_code != 200:
17@@ -1052,17 +1051,23 @@ def generate_query(ds, is_default, id=None, org_id=1):
18
19 else:
20 if "username" in ds and "password" in ds:
21- stmt = (
22- "UPDATE DATA_SOURCE SET basic_auth_user = ?, "
23- "basic_auth_password = ?, basic_auth = 1"
24- )
25- values = (ds["username"], ds["password"])
26+ username = ds["username"]
27+ password = ds["password"]
28+ basic_auth = 1
29 else:
30- stmt = (
31- "UPDATE DATA_SOURCE SET basic_auth_user = ?, "
32- "basic_auth_password = ?, basic_auth = 0"
33- )
34- values = ("", "")
35+ username = ""
36+ password = ""
37+ basic_auth = 0
38+
39+ stmt = (
40+ "UPDATE DATA_SOURCE SET "
41+ "basic_auth_user = ?, "
42+ "basic_auth_password = ?, "
43+ "basic_auth = ?,"
44+ "url = ? "
45+ "WHERE id = ?"
46+ )
47+ values = (username, password, basic_auth, ds["url"], id)
48 return (stmt, values)
49
50

Subscribers

People subscribed via source and target branches

to all changes: