Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
83a1665b
Commit
83a1665b
authored
Nov 07, 2013
by
Bruce Pennypacker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made URL an optional parameter
parent
31b5b66e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
library/monitoring/airbrake_deployment
+11
-3
No files found.
library/monitoring/airbrake_deployment
View file @
83a1665b
...
...
@@ -47,6 +47,11 @@ options:
description:
- A hash, number, tag, or other identifier showing what revision was deployed
required: false
url:
description:
- Optional URL to submit the notification to. Use to send notifications to Airbrake-compliant tools like Errbit.
required: false
default: https://airbrake.io/deploys
# informational: requirements for nodes
requirements: [ urllib, urllib2 ]
...
...
@@ -89,6 +94,7 @@ def main():
user
=
dict
(
required
=
False
),
repo
=
dict
(
required
=
False
),
revision
=
dict
(
required
=
False
),
url
=
dict
(
required
=
False
,
default
=
'https://airbrake.io/deploys'
)
),
supports_check_mode
=
True
)
...
...
@@ -110,21 +116,23 @@ def main():
params
[
"api_key"
]
=
module
.
params
[
"token"
]
url
=
module
.
params
.
get
(
'url'
)
# If we're in check mode, just exit pretending like we succeeded
if
module
.
check_mode
:
module
.
exit_json
(
changed
=
True
)
# Send the data to airbrake
try
:
req
=
urllib2
.
Request
(
"https://airbrake.io/deploys"
,
urllib
.
urlencode
(
params
))
req
=
urllib2
.
Request
(
url
,
urllib
.
urlencode
(
params
))
result
=
urllib2
.
urlopen
(
req
)
except
Exception
,
e
:
module
.
fail_json
(
msg
=
"unable to update airbrake
:
%
s"
%
e
)
module
.
fail_json
(
msg
=
"unable to update airbrake
via
%
s :
%
s"
%
(
url
,
e
)
)
else
:
if
result
.
code
==
200
:
module
.
exit_json
(
changed
=
True
)
else
:
module
.
fail_json
(
msg
=
"HTTP result code:
%
d
"
%
result
.
code
)
module
.
fail_json
(
msg
=
"HTTP result code:
%
d
connecting to
%
s"
%
(
result
.
code
,
url
)
)
# this is magic, see lib/ansible/module_common.py
#<<INCLUDE_ANSIBLE_MODULE_COMMON>>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment