mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
feat: rename server image_allow_deprecated option (#487)
##### SUMMARY Renamed the `allow_deprecated_image` to `image_allow_deprecated` argument to ensure the `image` related options use the same namespace. This is backward compatible, as we introduce a new alias for the old option name.
This commit is contained in:
parent
8738f369d3
commit
d88ecdbccc
2 changed files with 11 additions and 8 deletions
|
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- server - Renamed the `allow_deprecated_image` option to `image_allow_deprecated`.
|
||||||
|
|
@ -57,6 +57,12 @@ options:
|
||||||
- Hetzner Cloud Image (name or ID) to create the server from.
|
- Hetzner Cloud Image (name or ID) to create the server from.
|
||||||
- Required if server does not exist or when O(state=rebuild).
|
- Required if server does not exist or when O(state=rebuild).
|
||||||
type: str
|
type: str
|
||||||
|
image_allow_deprecated:
|
||||||
|
description:
|
||||||
|
- Allows the creation of servers with deprecated images.
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
aliases: [allow_deprecated_image]
|
||||||
location:
|
location:
|
||||||
description:
|
description:
|
||||||
- Hetzner Cloud Location (name or ID) to create the server in.
|
- Hetzner Cloud Location (name or ID) to create the server in.
|
||||||
|
|
@ -113,11 +119,6 @@ options:
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
aliases: [force_upgrade]
|
aliases: [force_upgrade]
|
||||||
allow_deprecated_image:
|
|
||||||
description:
|
|
||||||
- Allows the creation of servers with deprecated images.
|
|
||||||
type: bool
|
|
||||||
default: false
|
|
||||||
user_data:
|
user_data:
|
||||||
description:
|
description:
|
||||||
- User Data to be passed to the server on creation.
|
- User Data to be passed to the server on creation.
|
||||||
|
|
@ -506,7 +507,7 @@ class AnsibleHCloudServer(AnsibleHCloud):
|
||||||
|
|
||||||
if image.deprecated is not None:
|
if image.deprecated is not None:
|
||||||
available_until = image.deprecated + timedelta(days=90)
|
available_until = image.deprecated + timedelta(days=90)
|
||||||
if self.module.params.get("allow_deprecated_image"):
|
if self.module.params.get("image_allow_deprecated"):
|
||||||
self.module.warn(
|
self.module.warn(
|
||||||
f"You try to use a deprecated image. The image {image.name} will "
|
f"You try to use a deprecated image. The image {image.name} will "
|
||||||
f"continue to be available until {available_until.strftime('%Y-%m-%d')}."
|
f"continue to be available until {available_until.strftime('%Y-%m-%d')}."
|
||||||
|
|
@ -516,7 +517,7 @@ class AnsibleHCloudServer(AnsibleHCloud):
|
||||||
msg=(
|
msg=(
|
||||||
f"You try to use a deprecated image. The image {image.name} will "
|
f"You try to use a deprecated image. The image {image.name} will "
|
||||||
f"continue to be available until {available_until.strftime('%Y-%m-%d')}. "
|
f"continue to be available until {available_until.strftime('%Y-%m-%d')}. "
|
||||||
"If you want to use this image use allow_deprecated_image=true."
|
"If you want to use this image use image_allow_deprecated=true."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return image
|
return image
|
||||||
|
|
@ -884,6 +885,7 @@ class AnsibleHCloudServer(AnsibleHCloud):
|
||||||
id={"type": "int"},
|
id={"type": "int"},
|
||||||
name={"type": "str"},
|
name={"type": "str"},
|
||||||
image={"type": "str"},
|
image={"type": "str"},
|
||||||
|
image_allow_deprecated={"type": "bool", "default": False, "aliases": ["allow_deprecated_image"]},
|
||||||
server_type={"type": "str"},
|
server_type={"type": "str"},
|
||||||
location={"type": "str"},
|
location={"type": "str"},
|
||||||
datacenter={"type": "str"},
|
datacenter={"type": "str"},
|
||||||
|
|
@ -907,7 +909,6 @@ class AnsibleHCloudServer(AnsibleHCloud):
|
||||||
{"collection_name": "hetzner.hcloud", "name": "force_upgrade", "version": "4.0.0"}
|
{"collection_name": "hetzner.hcloud", "name": "force_upgrade", "version": "4.0.0"}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
allow_deprecated_image={"type": "bool", "default": False},
|
|
||||||
rescue_mode={"type": "str"},
|
rescue_mode={"type": "str"},
|
||||||
delete_protection={"type": "bool"},
|
delete_protection={"type": "bool"},
|
||||||
rebuild_protection={"type": "bool"},
|
rebuild_protection={"type": "bool"},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue