|
| 1 | +#!/usr/bin/python |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | + |
| 4 | +# Copyright 2025 Cloudera, Inc. All Rights Reserved. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | + |
| 18 | +DOCUMENTATION = r""" |
| 19 | +module: deprecation |
| 20 | +short_description: Display a deprecation warning |
| 21 | +description: |
| 22 | + - Displays a standard Ansible deprecation warning |
| 23 | +author: |
| 24 | + - "Webster Mudge (@wmudge)" |
| 25 | +version_added: "5.0.0" |
| 26 | +options: |
| 27 | + msg: |
| 28 | + description: |
| 29 | + - The deprecation warning message. |
| 30 | + type: str |
| 31 | + required: true |
| 32 | + version: |
| 33 | + description: |
| 34 | + - Version details for the warning message. |
| 35 | + type: str |
| 36 | + required: false |
| 37 | +""" |
| 38 | + |
| 39 | +EXAMPLES = r""" |
| 40 | +- name: Display a deprecation warning |
| 41 | + cloudera.cluster.deprecation: |
| 42 | + msg: A custom warning |
| 43 | +
|
| 44 | +- name: Display the deprecation warning with version details |
| 45 | + cloudera.cluster.deprecation: |
| 46 | + msg: A custom warning with version info |
| 47 | + version: "5.0.0" |
| 48 | +""" |
| 49 | + |
| 50 | +RETURN = r"""""" |
| 51 | + |
| 52 | +from ansible.module_utils.basic import AnsibleModule |
| 53 | + |
| 54 | + |
| 55 | +if __name__ == "__main__": |
| 56 | + module = AnsibleModule( |
| 57 | + argument_spec=dict( |
| 58 | + msg=dict(required="True"), |
| 59 | + version=dict(), |
| 60 | + ), |
| 61 | + ) |
| 62 | + |
| 63 | + module.deprecate(module.params.get("msg"), module.params.get("version", None)) |
| 64 | + module.exit_json() |
0 commit comments