Merge ~aieri/charm-prometheus-alertmanager:proxy into ~prometheus-charmers/charm-prometheus-alertmanager:master

Proposed by Andrea Ieri
Status: Merged
Approved by: Andrea Ieri
Approved revision: f5d8bc89834ae61fe1895712318d817c4232dfe1
Merged at revision: 8905bb3a611223f6985ed520231e433a23c5389c
Proposed branch: ~aieri/charm-prometheus-alertmanager:proxy
Merge into: ~prometheus-charmers/charm-prometheus-alertmanager:master
Diff against target: 44 lines (+10/-2)
3 files modified
metadata.yaml (+1/-1)
reactive/alertmanager.py (+5/-1)
templates/alertmanager.yml.j2 (+4/-0)
Reviewer Review Type Date Requested Status
Giuseppe Petralia Approve
Canonical IS Reviewers Pending
Review via email: mp+372814@code.launchpad.net

Commit message

Add support for http proxies

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
Giuseppe Petralia (peppepetra) wrote :

Comments inline

review: Needs Fixing
Revision history for this message
Giuseppe Petralia (peppepetra) wrote :

lgtm

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

Change successfully merged at revision 8905bb3a611223f6985ed520231e433a23c5389c

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/metadata.yaml b/metadata.yaml
2index 1690019..b3c1a7e 100644
3--- a/metadata.yaml
4+++ b/metadata.yaml
5@@ -17,4 +17,4 @@ provides:
6 interface: http
7 peers:
8 alertmanager-cluster:
9- interface: alertmanger-cluster
10+ interface: alertmanager-cluster
11diff --git a/reactive/alertmanager.py b/reactive/alertmanager.py
12index b72e97f..791abdf 100644
13--- a/reactive/alertmanager.py
14+++ b/reactive/alertmanager.py
15@@ -98,9 +98,13 @@ def write_alertmanager_config_yml():
16 with open(ALERTMANAGER_YML, "w") as f:
17 f.write(content)
18 else:
19+ proxy_settings = hookenv.env_proxy_settings()
20+ proxy_url = (proxy_settings.get('https_proxy') or
21+ proxy_settings.get('http_proxy'))
22 render(source=ALERTMANAGER_YML_TMPL,
23 target=ALERTMANAGER_YML,
24- context={'config': config}
25+ context={'config': config,
26+ 'proxy_url': proxy_url}
27 )
28 validate_config()
29 set_state('alertmanager.do-restart')
30diff --git a/templates/alertmanager.yml.j2 b/templates/alertmanager.yml.j2
31index a79f1f3..5fe9e35 100644
32--- a/templates/alertmanager.yml.j2
33+++ b/templates/alertmanager.yml.j2
34@@ -5,6 +5,10 @@ global:
35 # The smarthost and SMTP sender used for mail notifications.
36 smtp_smarthost: '{{ config.smtp_smarthost }}'
37 smtp_from: '{{ config.smtp_from }}'
38+{%- if proxy_url is defined and proxy_url %}
39+ http_config:
40+ proxy_url: '{{ proxy_url }}'
41+{% endif %}
42
43 # The root route on which each incoming alert enters.
44 route:

Subscribers

People subscribed via source and target branches