@@ -16,46 +16,37 @@ class KubernetesException(Exception):
1616 'supported_by' : 'community' }
1717
1818DOCUMENTATION = '''
19-
2019module: requeue_after
21-
2220short_description: Tells the controller to re-trigger reconciliation after the specified time
23-
2421version_added: "0.1"
25-
2622author: "Venkat Ramaraju (@VenkatRamaraju)"
27-
2823description:
2924 - Tells the controller to pause reconciliation and resume reconciliation after a specified amounts of time.
3025 If the requeue_reconciliation period is set to 't', reconciliation will occur in intervals of 't'.
31-
26+
3227options:
3328 time:
3429 type: str
3530 description:
3631 - A string containing a time period that will be set on the returned JSON object and then used to requeue
3732 reconciliation of an event. Time can be specified in any combination of hours, minutes, and seconds.
38-
3933'''
4034
4135EXAMPLES = '''
42-
4336- name: "Running the requeue_after module"
4437 requeue_after:
4538 time: 24h
46-
39+
4740- name: "Running the requeue_after module"
4841 requeue_after:
4942 time: 30m
50-
43+
5144- name: "Running the requeue_after module"
5245 requeue_after:
5346 time: 5s
54-
5547'''
5648
5749RETURN = '''
58-
5950result:
6051 description:
6152 - If a requeue period was specified under 'time' when calling the requeue_after period from the module,
@@ -80,17 +71,20 @@ class KubernetesException(Exception):
8071 requeued after.
8172 returned: success
8273 type: str
83-
8474'''
8575
8676from ansible .module_utils .basic import AnsibleModule
77+ import re
8778
8879
8980def requeue_after ():
9081 module = AnsibleModule (argument_spec = {
9182 'time' : {'type' : 'str' , 'required' : True },
9283 })
9384
85+ if not re .match ("^[hms0-9]*$" , module .params ['time' ]):
86+ module .fail_json (msg = "invalid time input" )
87+
9488 result = dict (
9589 period = module .params ['time' ],
9690 )
@@ -103,4 +97,4 @@ def main():
10397
10498
10599if __name__ == '__main__' :
106- main ()
100+ main ()
0 commit comments