diff options
5 files changed, 7 insertions, 19 deletions
diff --git a/changelogs/fragments/82946.yml b/changelogs/fragments/82946.yml new file mode 100644 index 0000000000..23f1886a5c --- /dev/null +++ b/changelogs/fragments/82946.yml @@ -0,0 +1,3 @@ +--- +removed_features: + - play_context - remove deprecated PlayContext.verbosity property (https://github.com/ansible/ansible/issues/82945). diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index 0ee1109448..2fe9539322 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -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 diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 926e702c00..cab676db42 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -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 diff --git a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py index 467c4b78e6..5ebd192454 100644 --- a/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py +++ b/test/support/network-integration/collections/ansible_collections/ansible/netcommon/plugins/connection/network_cli.py @@ -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( diff --git a/test/units/playbook/test_play_context.py b/test/units/playbook/test_play_context.py index 485a0e5378..7c911011b0 100644 --- a/test/units/playbook/test_play_context.py +++ b/test/units/playbook/test_play_context.py @@ -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() |