File: deprecated_thing.py

package info (click to toggle)
ansible-core 2.19.0~beta6-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,628 kB
  • sloc: python: 180,313; cs: 4,929; sh: 4,601; xml: 34; makefile: 21
file content (28 lines) | stat: -rw-r--r-- 1,710 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
This file is not used by the integration test, but serves a related purpose.
It triggers sanity test failures that can only occur for ansible-core, which need to be ignored to ensure the pylint plugin is functioning properly.
"""
from __future__ import annotations

from ansible.module_utils.datatag import deprecator_from_collection_name
from ansible.module_utils.common.warnings import deprecate


def do_stuff() -> None:
    deprecator = deprecator_from_collection_name('ansible.builtin')

    deprecate(msg='ansible-deprecated-version', version='2.18')
    deprecate(msg='ansible-deprecated-no-version')
    deprecate(msg='ansible-invalid-deprecated-version', version='not-a-version')
    # collection-deprecated-version - ansible-core cannot encounter this
    # collection-invalid-deprecated-version - ansible-core cannot encounter this
    # ansible-deprecated-no-collection-name - ansible-core cannot encounter this
    # wrong-collection-deprecated - ansible-core cannot encounter this
    # ansible-expired-deprecated-date - ansible-core cannot encounter this
    # ansible-invalid-deprecated-date - ansible-core cannot encounter this
    # ansible-deprecated-both-version-and-date - ansible-core cannot encounter this
    # removal-version-must-be-major - ansible-core cannot encounter this
    deprecate(msg='ansible-deprecated-date-not-permitted', date='2099-01-01')
    deprecate(msg='ansible-deprecated-unnecessary-collection-name', deprecator=deprecator, version='2.99')
    deprecate(msg='ansible-deprecated-collection-name-not-permitted', collection_name='ansible.builtin', version='2.99')
    # ansible-deprecated-both-collection-name-and-deprecator - ansible-core cannot encounter this