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
diff --git a/metadata.yaml b/metadata.yaml
index 1690019..b3c1a7e 100644
--- a/metadata.yaml
+++ b/metadata.yaml
@@ -17,4 +17,4 @@ provides:
17 interface: http17 interface: http
18peers:18peers:
19 alertmanager-cluster:19 alertmanager-cluster:
20 interface: alertmanger-cluster20 interface: alertmanager-cluster
diff --git a/reactive/alertmanager.py b/reactive/alertmanager.py
index b72e97f..791abdf 100644
--- a/reactive/alertmanager.py
+++ b/reactive/alertmanager.py
@@ -98,9 +98,13 @@ def write_alertmanager_config_yml():
98 with open(ALERTMANAGER_YML, "w") as f:98 with open(ALERTMANAGER_YML, "w") as f:
99 f.write(content)99 f.write(content)
100 else:100 else:
101 proxy_settings = hookenv.env_proxy_settings()
102 proxy_url = (proxy_settings.get('https_proxy') or
103 proxy_settings.get('http_proxy'))
101 render(source=ALERTMANAGER_YML_TMPL,104 render(source=ALERTMANAGER_YML_TMPL,
102 target=ALERTMANAGER_YML,105 target=ALERTMANAGER_YML,
103 context={'config': config}106 context={'config': config,
107 'proxy_url': proxy_url}
104 )108 )
105 validate_config()109 validate_config()
106 set_state('alertmanager.do-restart')110 set_state('alertmanager.do-restart')
diff --git a/templates/alertmanager.yml.j2 b/templates/alertmanager.yml.j2
index a79f1f3..5fe9e35 100644
--- a/templates/alertmanager.yml.j2
+++ b/templates/alertmanager.yml.j2
@@ -5,6 +5,10 @@ global:
5 # The smarthost and SMTP sender used for mail notifications.5 # The smarthost and SMTP sender used for mail notifications.
6 smtp_smarthost: '{{ config.smtp_smarthost }}'6 smtp_smarthost: '{{ config.smtp_smarthost }}'
7 smtp_from: '{{ config.smtp_from }}'7 smtp_from: '{{ config.smtp_from }}'
8{%- if proxy_url is defined and proxy_url %}
9 http_config:
10 proxy_url: '{{ proxy_url }}'
11{% endif %}
812
9# The root route on which each incoming alert enters.13# The root route on which each incoming alert enters.
10route:14route:

Subscribers

People subscribed via source and target branches