Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IGWN Computing and Software
GraceDB
GraceDB Server
Commits
873cd00d
Commit
873cd00d
authored
8 years ago
by
Tanner Prestegard
Committed by
Alexander Pace
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixing Twiml links in SMS messages.
parent
6ce73932
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gracedb/alert.py
+10
-5
10 additions, 5 deletions
gracedb/alert.py
with
10 additions
and
5 deletions
gracedb/alert.py
+
10
−
5
View file @
873cd00d
...
...
@@ -19,6 +19,8 @@ from query import filter_for_labels
from
gracedb.models
import
Event
import
socket
# These imports can be fragile, so they should be brought in only
# if use of the LVAlert overseer is really intended.
if
settings
.
USE_LVALERT_OVERSEER
:
...
...
@@ -45,7 +47,9 @@ def make_twilio_calls(event, twilio_recips, alert_type, **kwargs):
Note: twilio_recips is a list of users - we need phone numbers
and group memberships for permission checks.
"""
# Get server name.
hostname
=
socket
.
gethostname
()
if
(
alert_type
==
"
create
"
):
# twiml_base_url is the URL of a TwiML Bin
# (https://support.twilio.com/hc/en-us/articles/230878368)
...
...
@@ -62,8 +66,8 @@ def make_twilio_calls(event, twilio_recips, alert_type, **kwargs):
# </Sms>
# </Response>
twiml_base_url
=
'
https://handler.twilio.com/twiml/
'
+
settings
.
TWILIO_CREATE_KEY
twiml_url
=
'
{0}?pipeline={1}&graceid={2}
'
.
format
(
twiml_base_url
,
event
.
pipeline
.
name
,
event
.
graceid
())
twiml_url
=
'
{0}?pipeline={1}&graceid={2}
&server={3}
'
.
format
(
twiml_base_url
,
event
.
pipeline
.
name
,
event
.
graceid
()
,
hostname
)
elif
(
alert_type
==
"
label
"
):
# twiml_base_url is the URL of a TwiML Bin
# (https://support.twilio.com/hc/en-us/articles/230878368)
...
...
@@ -81,8 +85,9 @@ def make_twilio_calls(event, twilio_recips, alert_type, **kwargs):
# </Response>
twiml_base_url
=
'
https://handler.twilio.com/twiml/
'
+
settings
.
TWILIO_LABEL_KEY
label
=
kwargs
[
'
label
'
]
twiml_url
=
'
{0}?pipeline={1}&graceid={2}&label={3}&label_lower={4}
'
.
format
(
twiml_base_url
,
event
.
pipeline
.
name
,
event
.
graceid
(),
label
.
name
,
label
.
name
.
lower
())
twiml_url
=
'
{0}?pipeline={1}&graceid={2}&label={3}&label_lower={4}&server={5}
'
.
format
(
twiml_base_url
,
event
.
pipeline
.
name
,
event
.
graceid
(),
label
.
name
,
label
.
name
.
lower
(),
hostname
)
else
:
log
.
exception
(
'
Failed to process alert_type in make_twilio_calls
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment