Browse code

[stable-2.10] find: Specify elements type in paths (#70139) (#73970)

Fixes: #35990

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 87406890cf82d24ea78509e55bf94f2cf801dc6a)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>

Sam Doran authored on 2021/04/05 11:36:08
Showing 2 changed files
... ...
@@ -43,6 +43,7 @@ options:
43 43
               in undesirable ways.
44 44
         type: list
45 45
         aliases: [ pattern ]
46
+        elements: str
46 47
     excludes:
47 48
         description:
48 49
             - One or more (shell or regex) patterns, which type is controlled by C(use_regex) option.
... ...
@@ -51,6 +52,7 @@ options:
51 51
         type: list
52 52
         aliases: [ exclude ]
53 53
         version_added: "2.5"
54
+        elements: str
54 55
     contains:
55 56
         description:
56 57
             - A regular expression or pattern which should be matched against the file content.
... ...
@@ -61,6 +63,7 @@ options:
61 61
         type: list
62 62
         required: true
63 63
         aliases: [ name, path ]
64
+        elements: str
64 65
     file_type:
65 66
         description:
66 67
             - Type of file to select.
... ...
@@ -80,6 +83,7 @@ options:
80 80
             - Unqualified values are in bytes but b, k, m, g, and t can be appended to specify
81 81
               bytes, kilobytes, megabytes, gigabytes, and terabytes, respectively.
82 82
             - Size is not evaluated for directories.
83
+        type: str
83 84
     age_stamp:
84 85
         description:
85 86
             - Choose the file property against which we compare age.
... ...
@@ -355,9 +359,9 @@ def statinfo(st):
355 355
 def main():
356 356
     module = AnsibleModule(
357 357
         argument_spec=dict(
358
-            paths=dict(type='list', required=True, aliases=['name', 'path']),
359
-            patterns=dict(type='list', default=['*'], aliases=['pattern']),
360
-            excludes=dict(type='list', aliases=['exclude']),
358
+            paths=dict(type='list', required=True, aliases=['name', 'path'], elements='str'),
359
+            patterns=dict(type='list', default=['*'], aliases=['pattern'], elements='str'),
360
+            excludes=dict(type='list', aliases=['exclude'], elements='str'),
361 361
             contains=dict(type='str'),
362 362
             file_type=dict(type='str', default="file", choices=['any', 'directory', 'file', 'link']),
363 363
             age=dict(type='str'),
... ...
@@ -107,8 +107,6 @@ lib/ansible/modules/file.py pylint:ansible-bad-function
107 107
 lib/ansible/modules/file.py validate-modules:doc-default-does-not-match-spec
108 108
 lib/ansible/modules/file.py validate-modules:undocumented-parameter
109 109
 lib/ansible/modules/find.py use-argspec-type-path # fix needed
110
-lib/ansible/modules/find.py validate-modules:parameter-list-no-elements
111
-lib/ansible/modules/find.py validate-modules:parameter-type-not-in-doc
112 110
 lib/ansible/modules/lineinfile.py validate-modules:doc-choices-do-not-match-spec
113 111
 lib/ansible/modules/lineinfile.py validate-modules:doc-default-does-not-match-spec
114 112
 lib/ansible/modules/lineinfile.py validate-modules:nonexistent-parameter-documented