mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
feat: warn when experimental features are used (#669)
##### SUMMARY - Document how users can learn about experimental features. - Document how developers can release experimental features. - Log a warning when experimental features are being used. ##### ISSUE TYPE - Feature Pull Request
This commit is contained in:
parent
e0e3dc9562
commit
36053c7ee8
2 changed files with 61 additions and 0 deletions
31
plugins/module_utils/experimental.py
Normal file
31
plugins/module_utils/experimental.py
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Copyright: (c) 2025, Hetzner Cloud GmbH <info@hetzner-cloud.de>
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from .hcloud import AnsibleModule
|
||||
|
||||
|
||||
def experimental_warning_function(product: str, url: str):
|
||||
"""
|
||||
Create a reusable experimental warning function.
|
||||
|
||||
Usage:
|
||||
|
||||
product_experimental_warning = experimental_warning_function(
|
||||
"Product", "https://docs.hetzner.cloud/changelog#new-product"
|
||||
)
|
||||
|
||||
class AnsibleProduct(AnsibleHCloud):
|
||||
def __init__(self, module: AnsibleModule):
|
||||
product_experimental_warning(module)
|
||||
super().__init__(module)
|
||||
|
||||
:param product: Name of the experimental product.
|
||||
:param url: Changelog URL announcing the experimental product.
|
||||
"""
|
||||
message = f"Experimental: {product} is experimental, breaking changes may occur within minor releases. See {url} for more details."
|
||||
|
||||
def fn(module: AnsibleModule):
|
||||
module.warn(message)
|
||||
|
||||
return fn
|
||||
Loading…
Add table
Add a link
Reference in a new issue