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
50d54b1b
Commit
50d54b1b
authored
Jul 08, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ported hipchat callback to v2 (needs testing)
parent
e92e15b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
62 deletions
+11
-62
lib/ansible/plugins/callback/hipchat.py
+11
-62
No files found.
plugins/callbacks
/hipchat.py
→
lib/ansible/plugins/callback
/hipchat.py
View file @
50d54b1b
...
...
@@ -19,16 +19,15 @@ import os
import
urllib
import
urllib2
from
ansible
import
utils
try
:
import
prettytable
HAS_PRETTYTABLE
=
True
except
ImportError
:
HAS_PRETTYTABLE
=
False
from
ansible.plugins.callback
import
CallbackBase
class
CallbackModule
(
object
):
class
CallbackModule
(
CallbackBase
):
"""This is an example ansible callback plugin that sends status
updates to a HipChat channel during playbook execution.
...
...
@@ -42,11 +41,16 @@ class CallbackModule(object):
prettytable
"""
CALLBACK_VERSION
=
2.0
CALLBACK_TYPE
=
'notification'
def
__init__
(
self
,
display
):
super
(
CallbackModule
,
self
)
.
__init__
(
display
)
def
__init__
(
self
):
if
not
HAS_PRETTYTABLE
:
self
.
disabled
=
True
utils
.
warning
(
'The `prettytable` python module is not installed. '
self
.
display
.
warning
(
'The `prettytable` python module is not installed. '
'Disabling the HipChat callback plugin.'
)
self
.
msg_uri
=
'https://api.hipchat.com/v1/rooms/message'
...
...
@@ -57,7 +61,7 @@ class CallbackModule(object):
if
self
.
token
is
None
:
self
.
disabled
=
True
utils
.
warning
(
'HipChat token could not be loaded. The HipChat '
self
.
display
.
warning
(
'HipChat token could not be loaded. The HipChat '
'token can be provided using the `HIPCHAT_TOKEN` '
'environment variable.'
)
...
...
@@ -80,63 +84,8 @@ class CallbackModule(object):
response
=
urllib2
.
urlopen
(
url
,
urllib
.
urlencode
(
params
))
return
response
.
read
()
except
:
utils
.
warning
(
'Could not submit message to hipchat'
)
def
on_any
(
self
,
*
args
,
**
kwargs
):
pass
def
runner_on_failed
(
self
,
host
,
res
,
ignore_errors
=
False
):
pass
def
runner_on_ok
(
self
,
host
,
res
):
pass
def
runner_on_skipped
(
self
,
host
,
item
=
None
):
pass
def
runner_on_unreachable
(
self
,
host
,
res
):
pass
def
runner_on_no_hosts
(
self
):
pass
def
runner_on_async_poll
(
self
,
host
,
res
,
jid
,
clock
):
pass
def
runner_on_async_ok
(
self
,
host
,
res
,
jid
):
pass
def
runner_on_async_failed
(
self
,
host
,
res
,
jid
):
pass
def
playbook_on_start
(
self
):
pass
def
playbook_on_notify
(
self
,
host
,
handler
):
pass
def
playbook_on_no_hosts_matched
(
self
):
pass
def
playbook_on_no_hosts_remaining
(
self
):
pass
def
playbook_on_task_start
(
self
,
name
,
is_conditional
):
pass
def
playbook_on_vars_prompt
(
self
,
varname
,
private
=
True
,
prompt
=
None
,
encrypt
=
None
,
confirm
=
False
,
salt_size
=
None
,
salt
=
None
,
default
=
None
):
pass
def
playbook_on_setup
(
self
):
pass
def
playbook_on_import_for_host
(
self
,
host
,
imported_file
):
pass
self
.
display
.
warning
(
'Could not submit message to hipchat'
)
def
playbook_on_not_import_for_host
(
self
,
host
,
missing_file
):
pass
def
playbook_on_play_start
(
self
,
name
):
"""Display Playbook and play start messages"""
...
...
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