diff --git a/changelogs/fragments/c_deprecatd.yml b/changelogs/fragments/c_deprecatd.yml new file mode 100644 index 00000000000..bda3d275956 --- /dev/null +++ b/changelogs/fragments/c_deprecatd.yml @@ -0,0 +1,2 @@ +bugfixes: + - constants, internal _deprecated function always requires version. diff --git a/lib/ansible/cli/scripts/ansible_connection_cli_stub.py b/lib/ansible/cli/scripts/ansible_connection_cli_stub.py index b9a3e90e9ab..d2952bbe017 100755 --- a/lib/ansible/cli/scripts/ansible_connection_cli_stub.py +++ b/lib/ansible/cli/scripts/ansible_connection_cli_stub.py @@ -120,6 +120,7 @@ class ConnectionProcess(object): def run(self): try: + log_messages = self.connection.get_option('persistent_log_messages') while not self.connection._conn_closed: signal.signal(signal.SIGALRM, self.connect_timeout) signal.signal(signal.SIGTERM, self.handler) @@ -133,7 +134,6 @@ class ConnectionProcess(object): data = recv_data(s) if not data: break - log_messages = self.connection.get_option('persistent_log_messages') if log_messages: display.display("jsonrpc request: %s" % data, log_only=True) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 11b0583363d..417eec0614e 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -19,9 +19,6 @@ from ansible.module_utils.six import string_types from ansible.release import __version__ from ansible.utils.fqcn import add_internal_fqcns -# 4 versions above current -default_deprecated = to_text(float('.'.join(__version__.split('.')[0:2])) + 0.04) - def _warning(msg): ''' display is not guaranteed here, nor it being the full class, but try anyways, fallback to sys.stderr.write ''' @@ -33,7 +30,7 @@ def _warning(msg): sys.stderr.write(' [WARNING] %s\n' % (msg)) -def _deprecated(msg, version=default_deprecated): +def _deprecated(msg, version): ''' display is not guaranteed here, nor it being the full class, but try anyways, fallback to sys.stderr.write ''' try: from ansible.utils.display import Display @@ -55,11 +52,11 @@ class _DeprecatedSequenceConstant(Sequence): self._version = version def __len__(self): - _deprecated(self._msg, version=self._version) + _deprecated(self._msg, self._version) return len(self._value) def __getitem__(self, y): - _deprecated(self._msg, version=self._version) + _deprecated(self._msg, self._version) return self._value[y]