fix for slack callback breaks in 2.4 (#30932)
* fix for slack callback breaks in 2.4 fixes #30838
This commit is contained in:
parent
909100bd2c
commit
8378ac30b3
1 changed files with 12 additions and 17 deletions
|
@ -54,7 +54,6 @@ except ImportError:
|
||||||
cli = None
|
cli = None
|
||||||
|
|
||||||
from ansible.module_utils.urls import open_url
|
from ansible.module_utils.urls import open_url
|
||||||
from ansible.module_utils.parsing.convert_bool import boolean
|
|
||||||
from ansible.plugins.callback import CallbackBase
|
from ansible.plugins.callback import CallbackBase
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -75,13 +74,6 @@ class CallbackModule(CallbackBase):
|
||||||
|
|
||||||
def __init__(self, display=None):
|
def __init__(self, display=None):
|
||||||
|
|
||||||
self.disabled = False
|
|
||||||
|
|
||||||
if cli:
|
|
||||||
self._plugin_options = cli.options
|
|
||||||
else:
|
|
||||||
self._plugin_options = None
|
|
||||||
|
|
||||||
super(CallbackModule, self).__init__(display=display)
|
super(CallbackModule, self).__init__(display=display)
|
||||||
|
|
||||||
if not HAS_PRETTYTABLE:
|
if not HAS_PRETTYTABLE:
|
||||||
|
@ -90,7 +82,18 @@ class CallbackModule(CallbackBase):
|
||||||
'installed. Disabling the Slack callback '
|
'installed. Disabling the Slack callback '
|
||||||
'plugin.')
|
'plugin.')
|
||||||
|
|
||||||
self.webhook_url = self._plugin_options['webook_url']
|
self.playbook_name = None
|
||||||
|
|
||||||
|
# This is a 6 character identifier provided with each message
|
||||||
|
# This makes it easier to correlate messages when there are more
|
||||||
|
# than 1 simultaneous playbooks running
|
||||||
|
self.guid = uuid.uuid4().hex[:6]
|
||||||
|
|
||||||
|
def set_options(self, options):
|
||||||
|
|
||||||
|
super(CallbackModule, self).set_options(options)
|
||||||
|
|
||||||
|
self.webhook_url = self._plugin_options['webhook_url']
|
||||||
self.channel = self._plugin_options['channel']
|
self.channel = self._plugin_options['channel']
|
||||||
self.username = self._plugin_options['username']
|
self.username = self._plugin_options['username']
|
||||||
self.show_invocation = (self._display.verbosity > 1)
|
self.show_invocation = (self._display.verbosity > 1)
|
||||||
|
@ -102,14 +105,6 @@ class CallbackModule(CallbackBase):
|
||||||
'the `SLACK_WEBHOOK_URL` environment '
|
'the `SLACK_WEBHOOK_URL` environment '
|
||||||
'variable.')
|
'variable.')
|
||||||
|
|
||||||
else:
|
|
||||||
self.playbook_name = None
|
|
||||||
|
|
||||||
# This is a 6 character identifier provided with each message
|
|
||||||
# This makes it easier to correlate messages when there are more
|
|
||||||
# than 1 simultaneous playbooks running
|
|
||||||
self.guid = uuid.uuid4().hex[:6]
|
|
||||||
|
|
||||||
def send_msg(self, attachments):
|
def send_msg(self, attachments):
|
||||||
payload = {
|
payload = {
|
||||||
'channel': self.channel,
|
'channel': self.channel,
|
||||||
|
|
Loading…
Reference in a new issue