Skip to content

Commit

Permalink
play_context: remove deprecated PlayContext.verbosity (#82993)
Browse files Browse the repository at this point in the history
Fixes: #82945

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
  • Loading branch information
Akasurde committed Apr 9, 2024
1 parent cd36505 commit bb138b1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/82946.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
removed_features:
- play_context - remove deprecated PlayContext.verbosity property (https://github.com/ansible/ansible/issues/82945).
16 changes: 0 additions & 16 deletions lib/ansible/playbook/play_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion test/sanity/ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
connection_loader,
terminal_loader,
)
from ansible.utils.display import Display
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
to_list,
)
Expand All @@ -327,6 +328,7 @@
HAS_SCP = False

HAS_PYLIBSSH = False
display = Display()


def ensure_connect(func):
Expand Down Expand Up @@ -599,7 +601,7 @@ def _connect(self):
"""
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(
Expand Down
2 changes: 1 addition & 1 deletion test/units/playbook/test_play_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit bb138b1

Please sign in to comment.