Repository: ansible-collections/community.general

Issue:
plugins.callback.unixy: Warning 'CallbackModule' object has no attribute 'display_failed_stderr'
### Summary

When using the `community.general.unixy` callback plugin with a recent version of ansible I get a warning `'CallbackModule' object has no attribute 'display_failed_stderr'` and the task output is not shown.

This is a regression introduced by https://github.com/ansible/ansible/commit/dbdbfe845adac977a78c6484da1c5923754d83a2 via https://github.com/ansible/ansible/pull/77677

I already prepared a patch to fix this by using the new `self.get_option` interface and I'd be happy to open a PR with it.

### Issue Type

Bug Report

### Component Name

community.general.unixy

### Ansible Version

```console
$ ansible --version
ansible [core 2.14.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/kerel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/kerel/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.8 (main, Nov  1 2022, 14:18:21) [GCC 12.2.0] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = True

```


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general

# /usr/lib/python3.10/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 5.8.0  
```


### Configuration

```console (paste below)
$ cat ansible.cfg
[defaults]
stdout_callback = unixy
```


### OS / Environment

Manjaro Linux 22.0

### Steps to Reproduce

Any playbook with tasks producing output will trigger this. I tested with the following:

`playbook.yml`: 
```yaml (paste below)
---
- hosts: all
  tasks:
    - ansible.builtin.ping:
```

```
$ ansible-playbook playbook.yml

# in my specific case I run inside a virtualbox using vagrant:
$ sudo vagrant provision debian_bullseye --provision-with version
```

### Expected Results

The task output should be shown.

### Actual Results

Task output is missing, but warning shown:
```console (paste below)
==> debian_bullseye: Running provisioner: version (ansible)...
    debian_bullseye: Running ansible-playbook...
Executing playbook check_version.yml

- all on hosts: all -
Gathering Facts...
[WARNING]: Failure using method (v2_runner_on_ok) in callback plugin
(<ansible_collections.community.general.plugins.callback.unixy.CallbackModule
object at 0x7fb06d861a20>): 'CallbackModule' object has no attribute
'display_failed_stderr'
ansible.builtin.ping...

- Play recap -
  debian_bullseye            : ok=2    changed=0    unreachable=0    failed=0    rescued=0    ignored=0   
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/callback/unixy.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/callback/unixy.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @akatch
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->
!component =plugins/callback/unixy.py

Resolving patch:
diff --git a/plugins/callback/unixy.py b/plugins/callback/unixy.py
--- a/plugins/callback/unixy.py
+++ b/plugins/callback/unixy.py
@@ -63,7 +63,7 @@ def _get_task_display_name(self, task):
 
     def _preprocess_result(self, result):
         self.delegated_vars = result._result.get('_ansible_delegated_vars', None)
-        self._handle_exception(result._result, use_stderr=self.display_failed_stderr)
+        self._handle_exception(result._result, use_stderr=self.get_option('display_failed_stderr'))
         self._handle_warnings(result._result)
 
     def _process_result_output(self, result, msg):
@@ -109,7 +109,7 @@ def v2_playbook_on_play_start(self, play):
         self._display.display(msg)
 
     def v2_runner_on_skipped(self, result, ignore_errors=False):
-        if self.display_skipped_hosts:
+        if self.get_option('display_skipped_hosts'):
             self._preprocess_result(result)
             display_color = C.COLOR_SKIP
             msg = "skipped"
@@ -128,7 +128,7 @@ def v2_runner_on_failed(self, result, ignore_errors=False):
             msg += " | item: %s" % (item_value,)
 
         task_result = self._process_result_output(result, msg)
-        self._display.display("  " + task_result, display_color, stderr=self.display_failed_stderr)
+        self._display.display("  " + task_result, display_color, stderr=self.get_option('display_failed_stderr'))
 
     def v2_runner_on_ok(self, result, msg="ok", display_color=C.COLOR_OK):
         self._preprocess_result(result)
@@ -142,7 +142,7 @@ def v2_runner_on_ok(self, result, msg="ok", display_color=C.COLOR_OK):
             display_color = C.COLOR_CHANGED
             task_result = self._process_result_output(result, msg)
             self._display.display("  " + task_result, display_color)
-        elif self.display_ok_hosts:
+        elif self.get('display_ok_hosts'):
             task_result = self._process_result_output(result, msg)
             self._display.display("  " + task_result, display_color)
 
@@ -162,7 +162,7 @@ def v2_runner_on_unreachable(self, result):
         display_color = C.COLOR_UNREACHABLE
         task_result = self._process_result_output(result, msg)
 
-        self._display.display("  " + task_result, display_color, stderr=self.display_failed_stderr)
+        self._display.display("  " + task_result, display_color, stderr=self.get_option('display_failed_stderr'))
 
     def v2_on_file_diff(self, result):
         if result._task.loop and 'results' in result._result:
@@ -205,7 +205,7 @@ def v2_playbook_on_stats(self, stats):
                 colorize(u'ignored', t['ignored'], None)),
                 log_only=True
             )
-        if stats.custom and self.show_custom_stats:
+        if stats.custom and self.get_option('show_custom_stats'):
             self._display.banner("CUSTOM STATS: ")
             # per host
             # TODO: come up with 'pretty format'


Test patch: