Browse Source

Merge "Allow find on the executor"

changes/58/712958/42
Zuul 5 months ago
committed by Gerrit Code Review
parent
commit
1237e28dd9
5 changed files with 28 additions and 0 deletions
  1. +4
    -0
      releasenotes/notes/find-executor-cd3f110245c499c0.yaml
  2. +5
    -0
      tests/fixtures/config/ansible/git/org_plugin-project/playbooks/find_local_bad.yaml
  3. +5
    -0
      tests/fixtures/config/ansible/git/org_plugin-project/playbooks/find_local_good.yaml
  4. +2
    -0
      tests/unit/test_v3.py
  5. +12
    -0
      zuul/ansible/base/action/normal.py

+ 4
- 0
releasenotes/notes/find-executor-cd3f110245c499c0.yaml View File

@ -0,0 +1,4 @@
---
features:
- |
The ``find`` module is now allowed to run on the executor.

+ 5
- 0
tests/fixtures/config/ansible/git/org_plugin-project/playbooks/find_local_bad.yaml View File

@ -0,0 +1,5 @@
- hosts: localhost
tasks:
- name: Find in a bad location
find:
paths: '/tmp/'

+ 5
- 0
tests/fixtures/config/ansible/git/org_plugin-project/playbooks/find_local_good.yaml View File

@ -0,0 +1,5 @@
- hosts: localhost
tasks:
- name: Find in a good location
find:
paths: '{{ zuul.executor.work_root }}'

+ 2
- 0
tests/unit/test_v3.py View File

@ -2958,6 +2958,8 @@ class FunctionalAnsibleMixIn(object):
('file_local_bad', 'FAILURE'),
('fileglob_local_good', 'SUCCESS'),
('fileglob_local_bad', 'FAILURE'),
('find_local_good', 'SUCCESS'),
('find_local_bad', 'FAILURE'),
('zuul_return', 'SUCCESS'),
('password_create_good', 'SUCCESS'),
('password_null_good', 'SUCCESS'),


+ 12
- 0
zuul/ansible/base/action/normal.py View File

@ -103,3 +103,15 @@ class ActionModule(normal.ActionModule):
path = self._task.args.get(arg)
if path:
paths._fail_if_unsafe(path)
def handle_find(self):
'''Allow find module on localhost if it doesn't traverse unsafe files.
The :ansible:module:`find` can be used from the executor to
gather a list of files.
'''
find_paths = self._task.args.get('paths')
if not isinstance(find_paths, list):
find_paths = (find_paths,)
for path in find_paths:
paths._fail_if_unsafe(path)

Loading…
Cancel
Save