Skip to content

Commit a45fad2

Browse files
committed
Deprecate hetzner_user and hetzner_pass parameters; deprecate hetzner_token not being required; deprecate membership of robot action group.
1 parent 54954d3 commit a45fad2

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:
@@ -126,7 +126,7 @@
126126
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
127127
BASE_URL,
128128
ROBOT_DEFAULT_ARGUMENT_SPEC,
129-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
129+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
130130
fetch_url_json,
131131
)
132132

@@ -199,7 +199,7 @@ def main():
199199
zfs=dict(type='bool'),
200200
)
201201
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
202-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
202+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
203203
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
204204
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
205205
module = AnsibleModule(
@@ -215,6 +215,12 @@ def main():
215215
after = {}
216216
changes = {}
217217

218+
if module.params["hetzner_token"] is None:
219+
module.deprecate(
220+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
221+
collection_name="community.hrobot",
222+
version="3.0.0",
223+
)
218224
if module.params["hetzner_user"] is not None:
219225
# DEPRECATED: old API
220226
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
@@ -521,7 +521,7 @@
521521
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
522522
BASE_URL,
523523
ROBOT_DEFAULT_ARGUMENT_SPEC,
524-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
524+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
525525
fetch_url_json,
526526
)
527527

@@ -571,7 +571,7 @@ def main():
571571
full_info=dict(type='bool', default=False),
572572
)
573573
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
574-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
574+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
575575
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
576576
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
577577
module = AnsibleModule(
@@ -587,6 +587,12 @@ def main():
587587
full_info = module.params['full_info']
588588

589589
storageboxes = []
590+
if module.params["hetzner_token"] is None:
591+
module.deprecate(
592+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
593+
collection_name="community.hrobot",
594+
version="3.0.0",
595+
)
590596
if module.params["hetzner_user"] is not None:
591597
# DEPRECATED: old API
592598
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
@@ -85,7 +85,7 @@
8585
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
8686
BASE_URL,
8787
ROBOT_DEFAULT_ARGUMENT_SPEC,
88-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
88+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
8989
fetch_url_json,
9090
)
9191

@@ -110,7 +110,7 @@ def main():
110110
password=dict(type="str", no_log=True),
111111
)
112112
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
113-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
113+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
114114
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
115115
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
116116
module = AnsibleModule(
@@ -122,6 +122,12 @@ def main():
122122
id = module.params["id"]
123123
password = module.params.get("password")
124124

125+
if module.params["hetzner_token"] is None:
126+
module.deprecate(
127+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
128+
collection_name="community.hrobot",
129+
version="3.0.0",
130+
)
125131
if module.params["hetzner_user"] is not None:
126132
# DEPRECATED: old API
127133
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:
@@ -108,7 +108,7 @@
108108
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
109109
BASE_URL,
110110
ROBOT_DEFAULT_ARGUMENT_SPEC,
111-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
111+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
112112
fetch_url_json,
113113
)
114114

@@ -157,7 +157,7 @@ def main():
157157
snapshot_comment=dict(type='str')
158158
)
159159
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
160-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
160+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
161161
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
162162
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
163163

@@ -172,6 +172,12 @@ def main():
172172
snapshot_name = module.params['snapshot_name']
173173
snapshot_comment = module.params['snapshot_comment']
174174

175+
if module.params["hetzner_token"] is None:
176+
module.deprecate(
177+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
178+
collection_name="community.hrobot",
179+
version="3.0.0",
180+
)
175181
if module.params["hetzner_user"] is not None:
176182
# DEPRECATED: old API
177183

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+
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:
@@ -171,7 +171,7 @@
171171
from ansible_collections.community.hrobot.plugins.module_utils.robot import (
172172
BASE_URL,
173173
ROBOT_DEFAULT_ARGUMENT_SPEC,
174-
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT,
174+
_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED,
175175
fetch_url_json,
176176
)
177177

@@ -254,7 +254,7 @@ def main():
254254
),
255255
)
256256
argument_spec.update(ROBOT_DEFAULT_ARGUMENT_SPEC)
257-
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT)
257+
argument_spec.update(_ROBOT_DEFAULT_ARGUMENT_SPEC_COMPAT_DEPRECATED)
258258
argument_spec.update(API_DEFAULT_ARGUMENT_SPEC)
259259
argument_spec.update(_API_DEFAULT_ARGUMENT_SPEC_COMPAT)
260260
module = AnsibleModule(
@@ -270,6 +270,12 @@ def main():
270270
module.fail_json(msg='`plans` must have exactly one element')
271271
plan = plans[0]
272272

273+
if module.params["hetzner_token"] is None:
274+
module.deprecate(
275+
"The hetzner_token parameter will be required from community.hrobot 3.0.0 on.",
276+
collection_name="community.hrobot",
277+
version="3.0.0",
278+
)
273279
if module.params["hetzner_user"] is not None:
274280
# DEPRECATED: old API
275281
url = "{0}/storagebox/{1}/snapshotplan".format(BASE_URL, storagebox_id)

0 commit comments

Comments
 (0)