mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-29 11:40:22 -07:00
Callbacks: use ansible-core's version instead of trying to extract it (#10193)
* Use ansible-core's version instead of trying to extract it. * Adjust tests.
This commit is contained in:
parent
624a8aa120
commit
d922eaebce
7 changed files with 16 additions and 46 deletions
|
@ -91,6 +91,7 @@ import getpass
|
|||
|
||||
from os.path import basename
|
||||
|
||||
from ansible.module_utils.ansible_release import __version__ as ansible_version
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.parsing.ajson import AnsibleJSONEncoder
|
||||
from ansible.plugins.callback import CallbackBase
|
||||
|
@ -104,7 +105,6 @@ class SplunkHTTPCollectorSource(object):
|
|||
def __init__(self):
|
||||
self.ansible_check_mode = False
|
||||
self.ansible_playbook = ""
|
||||
self.ansible_version = ""
|
||||
self.session = str(uuid.uuid4())
|
||||
self.host = socket.gethostname()
|
||||
self.ip_address = socket.gethostbyname(socket.gethostname())
|
||||
|
@ -114,10 +114,6 @@ class SplunkHTTPCollectorSource(object):
|
|||
if result._task_fields['args'].get('_ansible_check_mode') is True:
|
||||
self.ansible_check_mode = True
|
||||
|
||||
if result._task_fields['args'].get('_ansible_version'):
|
||||
self.ansible_version = \
|
||||
result._task_fields['args'].get('_ansible_version')
|
||||
|
||||
if result._task._role:
|
||||
ansible_role = str(result._task._role)
|
||||
else:
|
||||
|
@ -143,7 +139,7 @@ class SplunkHTTPCollectorSource(object):
|
|||
data['ip_address'] = self.ip_address
|
||||
data['user'] = self.user
|
||||
data['runtime'] = runtime
|
||||
data['ansible_version'] = self.ansible_version
|
||||
data['ansible_version'] = ansible_version
|
||||
data['ansible_check_mode'] = self.ansible_check_mode
|
||||
data['ansible_host'] = result._host.name
|
||||
data['ansible_playbook'] = self.ansible_playbook
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue