Skip to content

Commit 974862c

Browse files
committed
Deprecate hetzner_user and hetzner_pass parameters; deprecate hetzner_token not being required; deprecate membership of robot action group.
1 parent e5d6b02 commit 974862c

13 files changed

+138
-36
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
deprecated_features:
2+
- "storagebox* modules - the ``hetzner_user`` and ``hetzner_pass`` options for these modules are deprecated; support will be removed in community.hrobot 3.0.0. Use ``hetzner_token`` instead (https://github.com/ansible-collections/community.hrobot/pull/173)."
3+
- "storagebox* modules - the ``hetzner_token`` option for these modules will be required from community.hrobot 3.0.0 on (https://github.com/ansible-collections/community.hrobot/pull/173)."
4+
- "storagebox* modules - membership in the ``community.hrobot.robot`` action group (module defaults group) is deprecated; the modules will be removed from the group in community.hrobot 3.0.0. Use ``community.hrobot.api`` instead (https://github.com/ansible-collections/community.hrobot/pull/173)."

plugins/doc_fragments/api.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,27 @@ class ModuleDocFragment(object):
4747
- If O(hetzner_password) is specified, O(hetzner_user) must also be specified, and O(hetzner_token) must not be specified.
4848
required: false
4949
"""
50+
51+
# Only for transition period
52+
_ROBOT_COMPAT_SHIM_DEPRECATION = r"""
53+
options:
54+
hetzner_token:
55+
description:
56+
- The API token for the Robot web-service user.
57+
- One of O(hetzner_token) and O(hetzner_user) must be specified.
58+
- This option will be required from community.hrobot 3.0.0 on.
59+
required: false
60+
hetzner_user:
61+
description:
62+
- The username for the Robot web-service user.
63+
- One of O(hetzner_token) and O(hetzner_user) must be specified.
64+
- If O(hetzner_user) is specified, O(hetzner_password) must also be specified, and O(hetzner_token) must not be specified.
65+
- This option is deprecated for this module, and support will be removed in community.hrobot 3.0.0.
66+
required: false
67+
hetzner_password:
68+
description:
69+
- The password for the Robot web-service user.
70+
- If O(hetzner_password) is specified, O(hetzner_user) must also be specified, and O(hetzner_token) must not be specified.
71+
- This option is deprecated for this module, and support will be removed in community.hrobot 3.0.0.
72+
required: false
73+
"""

plugins/doc_fragments/attributes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ class ModuleDocFragment(object):
8080
- community.hrobot.robot
8181
'''
8282

83+
# Only for transition period
84+
_ACTIONGROUP_ROBOT_AND_API_DEPRECATION = r'''
85+
options: {}
86+
attributes:
87+
action_group:
88+
description:
89+
- Use C(group/community.hrobot.robot) or C(group/community.hrobot.api) in C(module_defaults) to set defaults for this module.
90+
- The C(group/community.hrobot.robot) group is B(deprecated) for this module; the module will be removed from the group in community.hrobot 3.0.0.
91+
support: full
92+
membership:
93+
- community.hrobot.api
94+
- community.hrobot.robot
95+
'''
96+
8397
CONN = r"""
8498
options: {}
8599
attributes:

plugins/module_utils/robot.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
hetzner_password=dict(type='str', required=False, no_log=True),
3434
)
3535

36+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED = dict(
37+
hetzner_user=dict(type='str', required=False, removed_in_version="3.0.0", removed_from_collection="community.hrobot"),
38+
hetzner_password=dict(type='str', required=False, no_log=True, removed_in_version="3.0.0", removed_from_collection="community.hrobot"),
39+
)
40+
41+
3642
# The API endpoint is fixed.
3743
BASE_URL = "https://robot-ws.your-server.de"
3844

plugins/modules/storagebox.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
description:
1919
- Modify a storage box's basic configuration.
2020
extends_documentation_fragment:
21-
- community.hrobot.api._robot_compat_shim # must come before api and robot
21+
- community.hrobot.api._robot_compat_shim_deprecation # must come before api and robot
2222
- community.hrobot.api
2323
- community.hrobot.robot
2424
- community.hrobot.attributes
25-
- community.hrobot.attributes._actiongroup_robot_and_api # must come before the other two!
25+
- community.hrobot.attributes._actiongroup_robot_and_api_deprecation # must come before the other two!
2626
- community.hrobot.attributes.actiongroup_api
2727
- community.hrobot.attributes.actiongroup_robot
2828
attributes:
@@ -127,7 +127,7 @@
127127
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
128128
BASE_URL,
129129
ROBOT_DEFAULT_ARGUMENT_SPEC,
130-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
130+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
131131
fetch_url_json,
132132
)
133133

@@ -194,7 +194,7 @@ def main():
194194
zfs=dict(type='bool'),
195195
)
196196
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
197-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
197+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
198198
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
199199
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
200200
module = AnsibleModule(
@@ -210,6 +210,12 @@ def main():
210210
after = {}
211211
changes = {}
212212

213+
if module.params["hetzner_token"] is None:
214+
module.deprecate(
215+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
216+
collection_name="community.hrobot",
217+
removal_version="3.0.0",
218+
)
213219
if module.params["hetzner_user"] is not None:
214220
# DEPRECATED: old API
215221
url = "{0}/storagebox/{1}".format(BASE_URL, storagebox_id)

plugins/modules/storagebox_info.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
description:
1919
- Query information on one or more storage box.
2020
extends_documentation_fragment:
21-
- community.hrobot.api._robot_compat_shim # must come before api and robot
21+
- community.hrobot.api._robot_compat_shim_deprecation # must come before api and robot
2222
- community.hrobot.api
2323
- community.hrobot.robot
2424
- community.hrobot.attributes
25-
- community.hrobot.attributes._actiongroup_robot_and_api # must come before the other two!
25+
- community.hrobot.attributes._actiongroup_robot_and_api_deprecation # must come before the other two!
2626
- community.hrobot.attributes.actiongroup_api
2727
- community.hrobot.attributes.actiongroup_robot
2828
- community.hrobot.attributes.idempotent_not_modify_state
@@ -522,7 +522,7 @@
522522
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
523523
BASE_URL,
524524
ROBOT_DEFAULT_ARGUMENT_SPEC,
525-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
525+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
526526
fetch_url_json,
527527
)
528528

@@ -566,7 +566,7 @@ def main():
566566
full_info=dict(type='bool', default=False),
567567
)
568568
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
569-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
569+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
570570
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
571571
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
572572
module = AnsibleModule(
@@ -582,6 +582,12 @@ def main():
582582
full_info = module.params['full_info']
583583

584584
storageboxes = []
585+
if module.params["hetzner_token"] is None:
586+
module.deprecate(
587+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
588+
collection_name="community.hrobot",
589+
removal_version="3.0.0",
590+
)
585591
if module.params["hetzner_user"] is not None:
586592
# DEPRECATED: old API
587593
if storagebox_id is not None:

plugins/modules/storagebox_set_password.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
description:
1818
- (Re)set the password for a storage box.
1919
extends_documentation_fragment:
20-
- community.hrobot.api._robot_compat_shim # must come before api and robot
20+
- community.hrobot.api._robot_compat_shim_deprecation # must come before api and robot
2121
- community.hrobot.api
2222
- community.hrobot.robot
2323
- community.hrobot.attributes
24-
- community.hrobot.attributes._actiongroup_robot_and_api # must come before the other two!
24+
- community.hrobot.attributes._actiongroup_robot_and_api_deprecation # must come before the other two!
2525
- community.hrobot.attributes.actiongroup_api
2626
- community.hrobot.attributes.actiongroup_robot
2727
@@ -86,7 +86,7 @@
8686
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
8787
BASE_URL,
8888
ROBOT_DEFAULT_ARGUMENT_SPEC,
89-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
89+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
9090
fetch_url_json,
9191
)
9292

@@ -105,7 +105,7 @@ def main():
105105
password=dict(type="str", no_log=True),
106106
)
107107
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
108-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
108+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
109109
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
110110
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
111111
module = AnsibleModule(
@@ -117,6 +117,12 @@ def main():
117117
id = module.params["id"]
118118
password = module.params.get("password")
119119

120+
if module.params["hetzner_token"] is None:
121+
module.deprecate(
122+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
123+
collection_name="community.hrobot",
124+
removal_version="3.0.0",
125+
)
120126
if module.params["hetzner_user"] is not None:
121127
# DEPRECATED: old API
122128
url = "{0}/storagebox/{1}/password".format(BASE_URL, id)

plugins/modules/storagebox_snapshot.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
description:
1919
- Create, update comment, or delete a snapshot of a storage box.
2020
extends_documentation_fragment:
21-
- community.hrobot.api._robot_compat_shim # must come before api and robot
21+
- community.hrobot.api._robot_compat_shim_deprecation # must come before api and robot
2222
- community.hrobot.api
2323
- community.hrobot.robot
2424
- community.hrobot.attributes
25-
- community.hrobot.attributes._actiongroup_robot_and_api # must come before the other two!
25+
- community.hrobot.attributes._actiongroup_robot_and_api_deprecation # must come before the other two!
2626
- community.hrobot.attributes.actiongroup_api
2727
- community.hrobot.attributes.actiongroup_robot
2828
attributes:
@@ -110,7 +110,7 @@
110110
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
111111
BASE_URL,
112112
ROBOT_DEFAULT_ARGUMENT_SPEC,
113-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
113+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
114114
fetch_url_json,
115115
)
116116

@@ -153,7 +153,7 @@ def main():
153153
snapshot_comment=dict(type='str')
154154
)
155155
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
156-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
156+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
157157
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
158158
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
159159

@@ -168,6 +168,12 @@ def main():
168168
snapshot_name = module.params['snapshot_name']
169169
snapshot_comment = module.params['snapshot_comment']
170170

171+
if module.params["hetzner_token"] is None:
172+
module.deprecate(
173+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
174+
collection_name="community.hrobot",
175+
removal_version="3.0.0",
176+
)
171177
if module.params["hetzner_user"] is not None:
172178
# DEPRECATED: old API
173179

plugins/modules/storagebox_snapshot_info.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
description:
1919
- Query the snapshots for a storage box.
2020
extends_documentation_fragment:
21-
- community.hrobot.api._robot_compat_shim # must come before api and robot
21+
- community.hrobot.api._robot_compat_shim_deprecation # must come before api and robot
2222
- community.hrobot.api
2323
- community.hrobot.robot
2424
- community.hrobot.attributes
25-
- community.hrobot.attributes._actiongroup_robot_and_api # must come before the other two!
25+
- community.hrobot.attributes._actiongroup_robot_and_api_deprecation # must come before the other two!
2626
- community.hrobot.attributes.actiongroup_api
2727
- community.hrobot.attributes.actiongroup_robot
2828
- community.hrobot.attributes.idempotent_not_modify_state
@@ -167,7 +167,7 @@
167167
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
168168
BASE_URL,
169169
ROBOT_DEFAULT_ARGUMENT_SPEC,
170-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
170+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
171171
fetch_url_json,
172172
)
173173

@@ -194,7 +194,7 @@ def main():
194194
storagebox_id=dict(type='int', required=True),
195195
)
196196
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
197-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
197+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
198198
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
199199
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
200200
module = AnsibleModule(
@@ -204,6 +204,12 @@ def main():
204204

205205
storagebox_id = module.params['storagebox_id']
206206

207+
if module.params["hetzner_token"] is None:
208+
module.deprecate(
209+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
210+
collection_name="community.hrobot",
211+
removal_version="3.0.0",
212+
)
207213
if module.params["hetzner_user"] is not None:
208214
# DEPRECATED: old API
209215
url = "{0}/storagebox/{1}/snapshot".format(BASE_URL, storagebox_id)

plugins/modules/storagebox_snapshot_plan.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
description:
1919
- Enable, modify, and disable the snapshot plans of a storage box.
2020
extends_documentation_fragment:
21-
- community.hrobot.api._robot_compat_shim # must come before api and robot
21+
- community.hrobot.api._robot_compat_shim_deprecation # must come before api and robot
2222
- community.hrobot.api
2323
- community.hrobot.robot
2424
- community.hrobot.attributes
25-
- community.hrobot.attributes._actiongroup_robot_and_api # must come before the other two!
25+
- community.hrobot.attributes._actiongroup_robot_and_api_deprecation # must come before the other two!
2626
- community.hrobot.attributes.actiongroup_api
2727
- community.hrobot.attributes.actiongroup_robot
2828
attributes:
@@ -172,7 +172,7 @@
172172
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
173173
BASE_URL,
174174
ROBOT_DEFAULT_ARGUMENT_SPEC,
175-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
175+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
176176
fetch_url_json,
177177
)
178178

@@ -249,7 +249,7 @@ def main():
249249
),
250250
)
251251
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
252-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
252+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
253253
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
254254
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
255255
module = AnsibleModule(
@@ -265,6 +265,12 @@ def main():
265265
module.fail_json(msg='`plans` must have exactly one element')
266266
plan = plans[0]
267267

268+
if module.params["hetzner_token"] is None:
269+
module.deprecate(
270+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
271+
collection_name="community.hrobot",
272+
removal_version="3.0.0",
273+
)
268274
if module.params["hetzner_user"] is not None:
269275
# DEPRECATED: old API
270276
url = "{0}/storagebox/{1}/snapshotplan".format(BASE_URL, storagebox_id)

0 commit comments

Comments
 (0)