mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Consolidate boolean/mk_boolean conversion functions into a single location
Consolidate the module_utils, constants, and config functions that convert values into booleans into a single function in module_utils. Port code to use the module_utils.validate.convert_bool.boolean function isntead of mk_boolean.
This commit is contained in:
parent
f9c60e1a82
commit
ff22528b07
30 changed files with 433 additions and 102 deletions
|
@ -28,8 +28,8 @@ try:
|
|||
except ImportError:
|
||||
cli = None
|
||||
|
||||
from ansible.constants import mk_boolean
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
||||
try:
|
||||
|
@ -79,8 +79,9 @@ class CallbackModule(CallbackBase):
|
|||
self.webhook_url = os.getenv('SLACK_WEBHOOK_URL')
|
||||
self.channel = os.getenv('SLACK_CHANNEL', '#ansible')
|
||||
self.username = os.getenv('SLACK_USERNAME', 'ansible')
|
||||
self.show_invocation = mk_boolean(
|
||||
os.getenv('SLACK_INVOCATION', self._display.verbosity > 1)
|
||||
self.show_invocation = boolean(
|
||||
os.getenv('SLACK_INVOCATION', self._display.verbosity > 1),
|
||||
strict=False
|
||||
)
|
||||
|
||||
if self.webhook_url is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue