Browse Source

Removing Pager Team integration, project appears to be discontinued

pull/379/head
Pēteris Caune 4 years ago
parent
commit
8e51d26595
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
14 changed files with 14 additions and 171 deletions
  1. +5
    -0
      CHANGELOG.md
  2. +2
    -6
      hc/api/tests/test_notify.py
  3. +2
    -14
      hc/api/transports.py
  4. +0
    -32
      hc/front/tests/test_add_pagerteam.py
  5. +0
    -1
      hc/front/urls.py
  6. +0
    -20
      hc/front/views.py
  7. BIN
      static/img/integrations/setup_pagerteam_1.png
  8. +2
    -2
      templates/docs/configuring_notifications.html
  9. +2
    -2
      templates/docs/configuring_notifications.md
  10. +1
    -10
      templates/front/channels.html
  11. +0
    -7
      templates/front/welcome.html
  12. +0
    -71
      templates/integrations/add_pagerteam.html
  13. +0
    -5
      templates/integrations/pagerteam_description.html
  14. +0
    -1
      templates/integrations/pagerteam_title.html

+ 5
- 0
CHANGELOG.md View File

@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.
## Unreleased
### Bug Fixes
- Removing Pager Team integration, project appears to be discontinued
## v1.15.0 - 2020-06-04
### Improvements


+ 2
- 6
hc/api/tests/test_notify.py View File

@ -394,14 +394,10 @@ class NotifyTestCase(BaseTestCase):
@patch("hc.api.transports.requests.request")
def test_pagerteam(self, mock_post):
self._setup_data("pagerteam", "123")
mock_post.return_value.status_code = 200
self.channel.notify(self.check)
assert Notification.objects.count() == 1
args, kwargs = mock_post.call_args
payload = kwargs["json"]
self.assertEqual(payload["event_type"], "trigger")
self.assertFalse(mock_post.called)
self.assertEqual(Notification.objects.count(), 0)
@patch("hc.api.transports.requests.request")
def test_slack(self, mock_post):


+ 2
- 14
hc/api/transports.py View File

@ -331,20 +331,8 @@ class PagerTree(HttpTransport):
class PagerTeam(HttpTransport):
def notify(self, check):
url = self.channel.value
headers = {"Content-Type": "application/json"}
payload = {
"incident_key": str(check.code),
"event_type": "trigger" if check.status == "down" else "resolve",
"title": tmpl("pagerteam_title.html", check=check),
"description": tmpl("pagerteam_description.html", check=check),
"client": settings.SITE_NAME,
"client_url": settings.SITE_ROOT,
"tags": ",".join(check.tags_list()),
}
return self.post(url, json=payload, headers=headers)
def is_noop(self, check):
return True
class Pushbullet(HttpTransport):


+ 0
- 32
hc/front/tests/test_add_pagerteam.py View File

@ -1,32 +0,0 @@
from hc.api.models import Channel
from hc.test import BaseTestCase
class AddPagerTeamTestCase(BaseTestCase):
def setUp(self):
super(AddPagerTeamTestCase, self).setUp()
self.url = "/projects/%s/add_pagerteam/" % self.project.code
def test_instructions_work(self):
self.client.login(username="[email protected]", password="password")
r = self.client.get(self.url)
self.assertContains(r, "Pager Team")
def test_it_works(self):
form = {"value": "http://example.org"}
self.client.login(username="[email protected]", password="password")
r = self.client.post(self.url, form)
self.assertRedirects(r, self.channels_url)
c = Channel.objects.get()
self.assertEqual(c.kind, "pagerteam")
self.assertEqual(c.value, "http://example.org")
self.assertEqual(c.project, self.project)
def test_it_rejects_bad_url(self):
form = {"value": "not an URL"}
self.client.login(username="[email protected]", password="password")
r = self.client.post(self.url, form)
self.assertContains(r, "Enter a valid URL")

+ 0
- 1
hc/front/urls.py View File

@ -61,7 +61,6 @@ project_urls = [
path("add_mattermost/", views.add_mattermost, name="hc-add-mattermost"),
path("add_msteams/", views.add_msteams, name="hc-add-msteams"),
path("add_opsgenie/", views.add_opsgenie, name="hc-add-opsgenie"),
path("add_pagerteam/", views.add_pagerteam, name="hc-add-pagerteam"),
path("add_pagertree/", views.add_pagertree, name="hc-add-pagertree"),
path("add_pd/", views.add_pd, name="hc-add-pd"),
path("add_pdc/", views.add_pdc, name="hc-add-pdc"),


+ 0
- 20
hc/front/views.py View File

@ -1029,26 +1029,6 @@ def add_pagertree(request, code):
return render(request, "integrations/add_pagertree.html", ctx)
@login_required
def add_pagerteam(request, code):
project = _get_project_for_user(request, code)
if request.method == "POST":
form = forms.AddUrlForm(request.POST)
if form.is_valid():
channel = Channel(project=project, kind="pagerteam")
channel.value = form.cleaned_data["value"]
channel.save()
channel.assign_all_checks()
return redirect("hc-p-channels", project.code)
else:
form = forms.AddUrlForm()
ctx = {"page": "channels", "project": project, "form": form}
return render(request, "integrations/add_pagerteam.html", ctx)
@login_required
def add_slack(request, code):
project = _get_project_for_user(request, code)


BIN
static/img/integrations/setup_pagerteam_1.png View File

Before After
Width: 1142  |  Height: 787  |  Size: 36 KiB

+ 2
- 2
templates/docs/configuring_notifications.html View File

@ -33,8 +33,8 @@ not carry over to the next month.</p>
<p>If you want to receive repeated notifications for as long as a particular check is
down, you have a few different options:</p>
<ul>
<li>If you use an <strong>incident management system</strong> (PagerDuty, VictorOps, OpsGenie, PagerTree,
Pager Team), you can set up escalation rules there.</li>
<li>If you use an <strong>incident management system</strong> (PagerDuty, VictorOps, OpsGenie,
PagerTree), you can set up escalation rules there.</li>
<li>Use the <strong>Pushover</strong> integration with the "Emergency" priority. Pushover will
play a loud notification sound on your phone every 5 minutes until the notification
is acknowledged.</li>


+ 2
- 2
templates/docs/configuring_notifications.md View File

@ -44,8 +44,8 @@ When an account exceeds its SMS / WhatsApp monthly limit, SITE_NAME will:
If you want to receive repeated notifications for as long as a particular check is
down, you have a few different options:
* If you use an **incident management system** (PagerDuty, VictorOps, OpsGenie, PagerTree,
Pager Team), you can set up escalation rules there.
* If you use an **incident management system** (PagerDuty, VictorOps, OpsGenie,
PagerTree), you can set up escalation rules there.
* Use the **Pushover** integration with the "Emergency" priority. Pushover will
play a loud notification sound on your phone every 5 minutes until the notification
is acknowledged.


+ 1
- 10
templates/front/channels.html View File

@ -108,7 +108,7 @@
{% else %}
<span class="label label-default">Unconfirmed</span>
{% endif %}
{% elif ch.kind == "hipchat" %}
{% elif ch.kind == "hipchat" or ch.kind == "pagerteam" %}
Retired
{% else %}
Ready to deliver
@ -277,15 +277,6 @@
{% endif %}
</li>
<li>
<img src="{% static 'img/integrations/pagerteam.png' %}"
class="icon" alt="PagerTeam icon" />
<h2>Pager Team</h2>
<p>On-call rotations without limits.</p>
<a href="{% url 'hc-add-pagerteam' project.code %}" class="btn btn-primary">Add Integration</a>
</li>
<li>
<img src="{% static 'img/integrations/pagertree.png' %}"
class="icon" alt="PagerTree icon" />


+ 0
- 7
templates/front/welcome.html View File

@ -405,13 +405,6 @@
{% endif %}
</div>
<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
<div class="integration">
<img src="{% static 'img/integrations/pagerteam.png' %}" class="icon" alt="" />
<h3>Pager Team <br><small>Incident Management</small></h3>
</div>
</div>
<div class="col-lg-2 col-md-3 col-sm-4 col-xs-6">
<div class="integration">
<img src="{% static 'img/integrations/pagertree.png' %}" class="icon" alt="" />


+ 0
- 71
templates/integrations/add_pagerteam.html View File

@ -1,71 +0,0 @@
{% extends "base.html" %}
{% load humanize static hc_extras %}
{% block title %}Pager Team Integration for {% site_name %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-sm-12">
<h1>Pager Team</h1>
<p>You can integrate <a href="https://pagerteam.com">Pager Team</a>
with {% site_name %} to alert your on-call rotation whenever a check goes down.</p>
<h2>Setup Guide</h2>
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no"></span>
<p>
Log into your Pager Team account, select the rotation you wish to add this integration to. Click the <strong>Copy Webhook</strong> button.
</p>
</div>
<div class="col-sm-6">
<img
class="ai-guide-screenshot"
alt="Click create integration button"
src="{% static 'img/integrations/setup_pagerteam_1.png' %}">
</div>
</div>
<div class="row ai-step">
<div class="col-sm-6">
<span class="step-no"></span>
<p>
Paste the <strong>Webhook URL</strong> below. Save the integration, and you are done!
</p>
</div>
</div>
<h2>Integration Settings</h2>
<form method="post" class="form-horizontal">
{% csrf_token %}
<div class="form-group {{ form.value.css_classes }}">
<label for="post-url" class="col-sm-2 control-label">URL</label>
<div class="col-sm-10">
<input
id="post-url"
type="text"
class="form-control"
name="value"
placeholder="https://"
value="{{ form.value.value|default:"" }}">
{% if form.value.errors %}
<div class="help-block">
{{ form.value.errors|join:"" }}
</div>
{% endif %}
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Save Integration</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

+ 0
- 5
templates/integrations/pagerteam_description.html View File

@ -1,5 +0,0 @@
{% load humanize %}
{{ check.name_then_code }} is {{ check.status|upper }}.
{% if check.status == "down" %}
Last ping was {{ check.last_ping|naturaltime }}.
{% endif %}

+ 0
- 1
templates/integrations/pagerteam_title.html View File

@ -1 +0,0 @@
{{ check.name_then_code }} is {{ check.status|upper }}

Loading…
Cancel
Save