play_context: remove deprecated PlayContext.verbosity (#82993)

Fixes: #82945

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2024-04-09 08:08:52 -07:00 committed by GitHub
parent cd365057d3
commit bb138b1f6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 19 deletions

View File

@ -0,0 +1,3 @@
---
removed_features:
- play_context - remove deprecated PlayContext.verbosity property (https://github.com/ansible/ansible/issues/82945).

View File

@ -113,22 +113,6 @@ class PlayContext(Base):
# "PlayContext.force_handlers should not be used, the calling code should be using play itself instead"
force_handlers = FieldAttribute(isa='bool', default=False)
@property
def verbosity(self):
display.deprecated(
"PlayContext.verbosity is deprecated, use ansible.utils.display.Display.verbosity instead.",
version="2.18"
)
return self._internal_verbosity
@verbosity.setter
def verbosity(self, value):
display.deprecated(
"PlayContext.verbosity is deprecated, use ansible.utils.display.Display.verbosity instead.",
version="2.18"
)
self._internal_verbosity = value
def __init__(self, play=None, passwords=None, connection_lockfd=None):
# Note: play is really not optional. The only time it could be omitted is when we create
# a PlayContext just so we can invoke its deserialize method to load it from a serialized

View File

@ -196,7 +196,6 @@ test/units/cli/test_data/role_skeleton/README.md pymarkdown:line-length
test/integration/targets/find/files/hello_world.gbk no-smart-quotes
test/integration/targets/find/files/hello_world.gbk no-unwanted-characters
lib/ansible/galaxy/collection/__init__.py pylint:ansible-deprecated-version-comment # 2.18 deprecation
lib/ansible/playbook/play_context.py pylint:ansible-deprecated-version # 2.18 deprecation
lib/ansible/plugins/action/__init__.py pylint:ansible-deprecated-version # 2.18 deprecation
lib/ansible/template/__init__.py pylint:ansible-deprecated-version # 2.18 deprecation
lib/ansible/vars/manager.py pylint:ansible-deprecated-version # 2.18 deprecation

View File

@ -312,6 +312,7 @@ from ansible.plugins.loader import (
connection_loader,
terminal_loader,
)
from ansible.utils.display import Display
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
to_list,
)
@ -327,6 +328,7 @@ except ImportError:
HAS_SCP = False
HAS_PYLIBSSH = False
display = Display()
def ensure_connect(func):
@ -599,7 +601,7 @@ class Connection(NetworkConnectionBase):
"""
Connects to the remote device and starts the terminal
"""
if self._play_context.verbosity > 3:
if display.verbosity > 3:
logging.getLogger(self.ssh_type).setLevel(logging.DEBUG)
self.queue_message(

View File

@ -50,7 +50,7 @@ def test_play_context(mocker, parser, reset_cli_args):
assert play_context.password == ''
assert play_context.private_key_file == C.DEFAULT_PRIVATE_KEY_FILE
assert play_context.timeout == C.DEFAULT_TIMEOUT
assert play_context.verbosity == 2
assert getattr(play_context, 'verbosity', None) is None
assert play_context.check_mode is True
mock_play = mocker.MagicMock()