diff options
author | Felix Fontein <felix@fontein.de> | 2020-06-10 00:21:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 15:21:19 -0700 |
commit | a862ff2d4324f871565ef5b749c6a96ad0ad767e (patch) | |
tree | 2e34f490a9c5f5c9da26e26defb65d33cd2143e9 /test/support | |
parent | 7bff3d312f21ea1ccb3bc4a1abdb95a0369361f8 (diff) | |
download | ansible-a862ff2d4324f871565ef5b749c6a96ad0ad767e.tar.gz |
Deprecation revisited (#69926)
* Allow to specify collection_name separately for deprecation.
* Use new functionality in Ansible.
* Use new functionality in tests.
* Update tagging/untagging functions.
* Update pylint deprecated sanity test.
* Update validate-modules. Missing are basic checks for version_added (validate semantic version format for collections).
* Improve version validation. Re-add version_added validation.
* Make sure collection names are added to return docs before schema validation.
* Extra checks to avoid crashes on bad data.
* Make C# module utils code work, and update/extend tests.
* Add changelog fragment.
* Stop extracting collection name from potentially tagged versions/dates.
* Simplify C# code.
* Update Windows modules docs.
* Forgot semicolons.
Diffstat (limited to 'test/support')
23 files changed, 43 insertions, 26 deletions
diff --git a/test/support/integration/plugins/module_utils/azure_rm_common.py b/test/support/integration/plugins/module_utils/azure_rm_common.py index e995daa02e..a7b55e972e 100644 --- a/test/support/integration/plugins/module_utils/azure_rm_common.py +++ b/test/support/integration/plugins/module_utils/azure_rm_common.py @@ -449,8 +449,8 @@ class AzureRMModuleBase(object): ''' self.module.fail_json(msg=msg, **kwargs) - def deprecate(self, msg, version=None): - self.module.deprecate(msg, version) + def deprecate(self, msg, version=None, collection_name=None): + self.module.deprecate(msg, version, collection_name=collection_name) def log(self, msg, pretty_print=False): if pretty_print: diff --git a/test/support/integration/plugins/modules/aws_az_info.py b/test/support/integration/plugins/modules/aws_az_info.py index 0685a0b574..c1efed6f0b 100644 --- a/test/support/integration/plugins/modules/aws_az_info.py +++ b/test/support/integration/plugins/modules/aws_az_info.py @@ -86,7 +86,8 @@ def main(): module = AnsibleAWSModule(argument_spec=argument_spec) if module._name == 'aws_az_facts': - module.deprecate("The 'aws_az_facts' module has been renamed to 'aws_az_info'", version='ansible.builtin:2.14') + module.deprecate("The 'aws_az_facts' module has been renamed to 'aws_az_info'", + version='2.14', collection_name='ansible.builtin') connection = module.client('ec2', retry_decorator=AWSRetry.jittered_backoff()) diff --git a/test/support/integration/plugins/modules/azure_rm_functionapp_info.py b/test/support/integration/plugins/modules/azure_rm_functionapp_info.py index 19652577dd..40672f952d 100644 --- a/test/support/integration/plugins/modules/azure_rm_functionapp_info.py +++ b/test/support/integration/plugins/modules/azure_rm_functionapp_info.py @@ -136,7 +136,8 @@ class AzureRMFunctionAppInfo(AzureRMModuleBase): is_old_facts = self.module._name == 'azure_rm_functionapp_facts' if is_old_facts: - self.module.deprecate("The 'azure_rm_functionapp_facts' module has been renamed to 'azure_rm_functionapp_info'", version='ansible.builtin:2.13') + self.module.deprecate("The 'azure_rm_functionapp_facts' module has been renamed to 'azure_rm_functionapp_info'", + version='2.13', collection_name='ansible.builtin') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) diff --git a/test/support/integration/plugins/modules/azure_rm_mariadbconfiguration_info.py b/test/support/integration/plugins/modules/azure_rm_mariadbconfiguration_info.py index df1b41da13..3faac5eb5a 100644 --- a/test/support/integration/plugins/modules/azure_rm_mariadbconfiguration_info.py +++ b/test/support/integration/plugins/modules/azure_rm_mariadbconfiguration_info.py @@ -140,7 +140,7 @@ class AzureRMMariaDbConfigurationInfo(AzureRMModuleBase): is_old_facts = self.module._name == 'azure_rm_mariadbconfiguration_facts' if is_old_facts: self.module.deprecate("The 'azure_rm_mariadbconfiguration_facts' module has been renamed to 'azure_rm_mariadbconfiguration_info'", - version='ansible.builtin:2.13') + version='2.13', collection_name='ansible.builtin') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) diff --git a/test/support/integration/plugins/modules/azure_rm_mariadbdatabase_info.py b/test/support/integration/plugins/modules/azure_rm_mariadbdatabase_info.py index dbbb2da970..e9c99c1483 100644 --- a/test/support/integration/plugins/modules/azure_rm_mariadbdatabase_info.py +++ b/test/support/integration/plugins/modules/azure_rm_mariadbdatabase_info.py @@ -146,7 +146,7 @@ class AzureRMMariaDbDatabaseInfo(AzureRMModuleBase): is_old_facts = self.module._name == 'azure_rm_mariadbdatabase_facts' if is_old_facts: self.module.deprecate("The 'azure_rm_mariadbdatabase_facts' module has been renamed to 'azure_rm_mariadbdatabase_info'", - version='ansible.builtin:2.13') + version='2.13', collection_name='ansible.builtin') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) diff --git a/test/support/integration/plugins/modules/azure_rm_mariadbfirewallrule_info.py b/test/support/integration/plugins/modules/azure_rm_mariadbfirewallrule_info.py index c6857bea48..ef71be8dce 100644 --- a/test/support/integration/plugins/modules/azure_rm_mariadbfirewallrule_info.py +++ b/test/support/integration/plugins/modules/azure_rm_mariadbfirewallrule_info.py @@ -142,7 +142,7 @@ class AzureRMMariaDbFirewallRuleInfo(AzureRMModuleBase): is_old_facts = self.module._name == 'azure_rm_mariadbfirewallrule_facts' if is_old_facts: self.module.deprecate("The 'azure_rm_mariadbfirewallrule_facts' module has been renamed to 'azure_rm_mariadbfirewallrule_info'", - version='ansible.builtin:2.13') + version='2.13', collection_name='ansible.builtin') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) diff --git a/test/support/integration/plugins/modules/azure_rm_mariadbserver_info.py b/test/support/integration/plugins/modules/azure_rm_mariadbserver_info.py index 5e8e1a82da..464aa4d8a5 100644 --- a/test/support/integration/plugins/modules/azure_rm_mariadbserver_info.py +++ b/test/support/integration/plugins/modules/azure_rm_mariadbserver_info.py @@ -193,7 +193,8 @@ class AzureRMMariaDbServerInfo(AzureRMModuleBase): def exec_module(self, **kwargs): is_old_facts = self.module._name == 'azure_rm_mariadbserver_facts' if is_old_facts: - self.module.deprecate("The 'azure_rm_mariadbserver_facts' module has been renamed to 'azure_rm_mariadbserver_info'", version='ansible.builtin:2.13') + self.module.deprecate("The 'azure_rm_mariadbserver_facts' module has been renamed to 'azure_rm_mariadbserver_info'", + version='2.13', collection_name='ansible.builtin') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) diff --git a/test/support/integration/plugins/modules/azure_rm_resource_info.py b/test/support/integration/plugins/modules/azure_rm_resource_info.py index 5d553a0d42..f797f66219 100644 --- a/test/support/integration/plugins/modules/azure_rm_resource_info.py +++ b/test/support/integration/plugins/modules/azure_rm_resource_info.py @@ -336,7 +336,8 @@ class AzureRMResourceInfo(AzureRMModuleBase): def exec_module(self, **kwargs): is_old_facts = self.module._name == 'azure_rm_resource_facts' if is_old_facts: - self.module.deprecate("The 'azure_rm_resource_facts' module has been renamed to 'azure_rm_resource_info'", version='ansible.builtin:2.13') + self.module.deprecate("The 'azure_rm_resource_facts' module has been renamed to 'azure_rm_resource_info'", + version='2.13', collection_name='ansible.builtin') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) diff --git a/test/support/integration/plugins/modules/azure_rm_webapp_info.py b/test/support/integration/plugins/modules/azure_rm_webapp_info.py index e722ffdf16..2228680306 100644 --- a/test/support/integration/plugins/modules/azure_rm_webapp_info.py +++ b/test/support/integration/plugins/modules/azure_rm_webapp_info.py @@ -265,7 +265,8 @@ class AzureRMWebAppInfo(AzureRMModuleBase): def exec_module(self, **kwargs): is_old_facts = self.module._name == 'azure_rm_webapp_facts' if is_old_facts: - self.module.deprecate("The 'azure_rm_webapp_facts' module has been renamed to 'azure_rm_webapp_info'", version='ansible.builtin:2.13') + self.module.deprecate("The 'azure_rm_webapp_facts' module has been renamed to 'azure_rm_webapp_info'", + version='2.13', collection_name='ansible.builtin') for key in self.module_arg_spec: setattr(self, key, kwargs[key]) diff --git a/test/support/integration/plugins/modules/cloudformation_info.py b/test/support/integration/plugins/modules/cloudformation_info.py index d10429326d..ee2e5c178b 100644 --- a/test/support/integration/plugins/modules/cloudformation_info.py +++ b/test/support/integration/plugins/modules/cloudformation_info.py @@ -302,7 +302,8 @@ def main(): is_old_facts = module._name == 'cloudformation_facts' if is_old_facts: module.deprecate("The 'cloudformation_facts' module has been renamed to 'cloudformation_info', " - "and the renamed one no longer returns ansible_facts", version='ansible.builtin:2.13') + "and the renamed one no longer returns ansible_facts", + version='2.13', collection_name='ansible.builtin') service_mgr = CloudFormationServiceManager(module) diff --git a/test/support/integration/plugins/modules/docker_swarm.py b/test/support/integration/plugins/modules/docker_swarm.py index e802e20245..a2c076c518 100644 --- a/test/support/integration/plugins/modules/docker_swarm.py +++ b/test/support/integration/plugins/modules/docker_swarm.py @@ -450,7 +450,7 @@ class SwarmManager(DockerBaseClass): if self.state == 'inspect': self.client.module.deprecate( "The 'inspect' state is deprecated, please use 'docker_swarm_info' to inspect swarm cluster", - version='ansible.builtin:2.12') + version='2.12', collection_name='ansible.builtin') choice_map.get(self.state)() diff --git a/test/support/integration/plugins/modules/ec2.py b/test/support/integration/plugins/modules/ec2.py index b01c5a66d5..952aa5a1a6 100644 --- a/test/support/integration/plugins/modules/ec2.py +++ b/test/support/integration/plugins/modules/ec2.py @@ -1695,7 +1695,7 @@ def main(): module.deprecate( msg='Support for passing both group and group_id has been deprecated. ' 'Currently group_id is ignored, in future passing both will result in an error', - version='ansible.builtin:2.14') + version='2.14', collection_name='ansible.builtin') if not HAS_BOTO: module.fail_json(msg='boto required for this module') diff --git a/test/support/integration/plugins/modules/ec2_ami_info.py b/test/support/integration/plugins/modules/ec2_ami_info.py index e7cbe0532c..53c2374de8 100644 --- a/test/support/integration/plugins/modules/ec2_ami_info.py +++ b/test/support/integration/plugins/modules/ec2_ami_info.py @@ -270,7 +270,8 @@ def main(): module = AnsibleAWSModule(argument_spec=argument_spec, supports_check_mode=True) if module._module._name == 'ec2_ami_facts': - module._module.deprecate("The 'ec2_ami_facts' module has been renamed to 'ec2_ami_info'", version='ansible.builtin:2.13') + module._module.deprecate("The 'ec2_ami_facts' module has been renamed to 'ec2_ami_info'", + version='2.13', collection_name='ansible.builtin') ec2_client = module.client('ec2') diff --git a/test/support/integration/plugins/modules/ec2_eni_info.py b/test/support/integration/plugins/modules/ec2_eni_info.py index 31efbfdd38..1e281a4938 100644 --- a/test/support/integration/plugins/modules/ec2_eni_info.py +++ b/test/support/integration/plugins/modules/ec2_eni_info.py @@ -259,7 +259,8 @@ def main(): module = AnsibleModule(argument_spec=argument_spec) if module._name == 'ec2_eni_facts': - module.deprecate("The 'ec2_eni_facts' module has been renamed to 'ec2_eni_info'", version='ansible.builtin:2.13') + module.deprecate("The 'ec2_eni_facts' module has been renamed to 'ec2_eni_info'", + version='2.13', collection_name='ansible.builtin') if not HAS_BOTO3: module.fail_json(msg='boto3 required for this module') diff --git a/test/support/integration/plugins/modules/ec2_instance_info.py b/test/support/integration/plugins/modules/ec2_instance_info.py index cd8e0cd7d5..0836ef3b80 100644 --- a/test/support/integration/plugins/modules/ec2_instance_info.py +++ b/test/support/integration/plugins/modules/ec2_instance_info.py @@ -552,7 +552,8 @@ def main(): supports_check_mode=True ) if module._name == 'ec2_instance_facts': - module.deprecate("The 'ec2_instance_facts' module has been renamed to 'ec2_instance_info'", version='ansible.builtin:2.13') + module.deprecate("The 'ec2_instance_facts' module has been renamed to 'ec2_instance_info'", + version='2.13', collection_name='ansible.builtin') if not HAS_BOTO3: module.fail_json(msg='boto3 required for this module') diff --git a/test/support/integration/plugins/modules/iam_role.py b/test/support/integration/plugins/modules/iam_role.py index 1027232be0..bd666f249c 100644 --- a/test/support/integration/plugins/modules/iam_role.py +++ b/test/support/integration/plugins/modules/iam_role.py @@ -637,7 +637,8 @@ def main(): if module.params.get('purge_policies') is None: module.deprecate('In Ansible 2.14 the default value of purge_policies will change from true to false.' - ' To maintain the existing behaviour explicity set purge_policies=true', version='ansible.builtin:2.14') + ' To maintain the existing behaviour explicity set purge_policies=true', + version='2.14', collection_name='ansible.builtin') if module.params.get('boundary'): if module.params.get('create_instance_profile'): diff --git a/test/support/integration/plugins/modules/k8s_info.py b/test/support/integration/plugins/modules/k8s_info.py index 37e8066895..f480bcedc3 100644 --- a/test/support/integration/plugins/modules/k8s_info.py +++ b/test/support/integration/plugins/modules/k8s_info.py @@ -142,7 +142,8 @@ class KubernetesInfoModule(KubernetesAnsibleModule): supports_check_mode=True, **kwargs) if self._name == 'k8s_facts': - self.deprecate("The 'k8s_facts' module has been renamed to 'k8s_info'", version='ansible.builtin:2.13') + self.deprecate("The 'k8s_facts' module has been renamed to 'k8s_info'", + version='2.13', collection_name='ansible.builtin') def execute_module(self): self.client = self.get_api_client() diff --git a/test/support/integration/plugins/modules/openssl_certificate.py b/test/support/integration/plugins/modules/openssl_certificate.py index d8af142e1b..28780bf22c 100644 --- a/test/support/integration/plugins/modules/openssl_certificate.py +++ b/test/support/integration/plugins/modules/openssl_certificate.py @@ -2654,7 +2654,7 @@ def main(): if provider == 'assertonly': module.deprecate("The 'assertonly' provider is deprecated; please see the examples of " "the 'openssl_certificate' module on how to replace it with other modules", - version='ansible.builtin:2.13') + version='2.13', collection_name='ansible.builtin') elif provider == 'selfsigned': if module.params['privatekey_path'] is None and module.params['privatekey_content'] is None: module.fail_json(msg='One of privatekey_path and privatekey_content must be specified for the selfsigned provider.') @@ -2702,7 +2702,8 @@ def main(): except AttributeError: module.fail_json(msg='You need to have PyOpenSSL>=0.15') - module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', version='ansible.builtin:2.13') + module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', + version='2.13', collection_name='ansible.builtin') if provider == 'selfsigned': certificate = SelfSignedCertificate(module) elif provider == 'acme': diff --git a/test/support/integration/plugins/modules/openssl_certificate_info.py b/test/support/integration/plugins/modules/openssl_certificate_info.py index 2b947a8777..27e65153ea 100644 --- a/test/support/integration/plugins/modules/openssl_certificate_info.py +++ b/test/support/integration/plugins/modules/openssl_certificate_info.py @@ -845,7 +845,8 @@ def main(): except AttributeError: module.fail_json(msg='You need to have PyOpenSSL>=0.15') - module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', version='ansible.builtin:2.13') + module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', + version='2.13', collection_name='ansible.builtin') certificate = CertificateInfoPyOpenSSL(module) elif backend == 'cryptography': if not CRYPTOGRAPHY_FOUND: diff --git a/test/support/integration/plugins/modules/openssl_csr.py b/test/support/integration/plugins/modules/openssl_csr.py index b184cabe9d..2d831f35bf 100644 --- a/test/support/integration/plugins/modules/openssl_csr.py +++ b/test/support/integration/plugins/modules/openssl_csr.py @@ -1091,7 +1091,8 @@ def main(): if module.params['version'] != 1: module.deprecate('The version option will only support allowed values from Ansible 2.14 on. ' - 'Currently, only the value 1 is allowed by RFC 2986', version='ansible.builtin:2.14') + 'Currently, only the value 1 is allowed by RFC 2986', + version='2.14', collection_name='ansible.builtin') base_dir = os.path.dirname(module.params['path']) or '.' if not os.path.isdir(base_dir): @@ -1125,7 +1126,8 @@ def main(): except AttributeError: module.fail_json(msg='You need to have PyOpenSSL>=0.15 to generate CSRs') - module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', version='ansible.builtin:2.13') + module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', + version='2.13', collection_name='ansible.builtin') csr = CertificateSigningRequestPyOpenSSL(module) elif backend == 'cryptography': if not CRYPTOGRAPHY_FOUND: diff --git a/test/support/integration/plugins/modules/openssl_privatekey.py b/test/support/integration/plugins/modules/openssl_privatekey.py index d0ce6ae7b0..9c247a3942 100644 --- a/test/support/integration/plugins/modules/openssl_privatekey.py +++ b/test/support/integration/plugins/modules/openssl_privatekey.py @@ -908,7 +908,8 @@ def main(): if not PYOPENSSL_FOUND: module.fail_json(msg=missing_required_lib('pyOpenSSL >= {0}'.format(MINIMAL_PYOPENSSL_VERSION)), exception=PYOPENSSL_IMP_ERR) - module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', version='ansible.builtin:2.13') + module.deprecate('The module is using the PyOpenSSL backend. This backend has been deprecated', + version='2.13', collection_name='ansible.builtin') private_key = PrivateKeyPyOpenSSL(module) elif backend == 'cryptography': if not CRYPTOGRAPHY_FOUND: diff --git a/test/support/integration/plugins/modules/python_requirements_info.py b/test/support/integration/plugins/modules/python_requirements_info.py index e89f5db26e..5b5c3e50fa 100644 --- a/test/support/integration/plugins/modules/python_requirements_info.py +++ b/test/support/integration/plugins/modules/python_requirements_info.py @@ -118,7 +118,8 @@ def main(): supports_check_mode=True, ) if module._name == 'python_requirements_facts': - module.deprecate("The 'python_requirements_facts' module has been renamed to 'python_requirements_info'", version='ansible.builtin:2.13') + module.deprecate("The 'python_requirements_facts' module has been renamed to 'python_requirements_info'", + version='2.13', collection_name='ansible.builtin') if not HAS_DISTUTILS: module.fail_json( msg='Could not import "distutils" and "pkg_resources" libraries to introspect python environment.', diff --git a/test/support/integration/plugins/modules/xml.py b/test/support/integration/plugins/modules/xml.py index 281e9f5558..b5b35a384e 100644 --- a/test/support/integration/plugins/modules/xml.py +++ b/test/support/integration/plugins/modules/xml.py @@ -886,7 +886,7 @@ def main(): # TODO: Remove this in Ansible v2.12 (and reinstate strict parameter test above) and remove the integration test example if content == 'attribute' and attribute is not None: module.deprecate("Parameter 'attribute=%s' is ignored when using 'content=attribute' only 'xpath' is used. Please remove entry." % attribute, - 'ansible.builtin:2.12') + '2.12', collection_name='ansible.builtin') # Check if the file exists if xml_string: |