Skip to content

Commit 80107bd

Browse files
committed
fix(plugins/bitwarden): make Display import optional for AnsiballZ compatibility
ansible.utils.display is not available when module_utils code runs inside an AnsiballZ process (module context). Fall back to a no-op display to avoid ModuleNotFoundError.
1 parent 820a640 commit 80107bd

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

plugins/module_utils/bitwarden.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,16 @@
2929
from ansible.module_utils._text import to_bytes, to_native, to_text
3030
from ansible.module_utils.urls import (ConnectionError, SSLValidationError,
3131
open_url)
32-
from ansible.utils.display import Display
33-
34-
display = Display()
32+
try:
33+
from ansible.utils.display import Display
34+
display = Display()
35+
except ImportError:
36+
# When used from a module (not a lookup plugin), this code runs inside an AnsiballZ
37+
# process on the remote host where ansible.utils.display is not available.
38+
class _NoopDisplay:
39+
def vvv(self, msg, **kwargs):
40+
pass
41+
display = _NoopDisplay()
3542

3643

3744
def prepare_multipart_no_base64(fields):

0 commit comments

Comments
 (0)