Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ansible 2.2] with_fileglob emits warning, fails to glob #17192

Closed
mgedmin opened this issue Aug 23, 2016 · 3 comments
Closed

[Ansible 2.2] with_fileglob emits warning, fails to glob #17192

mgedmin opened this issue Aug 23, 2016 · 3 comments
Assignees
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Milestone

Comments

@mgedmin
Copy link
Contributor

mgedmin commented Aug 23, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME

with_fileglob

ANSIBLE VERSION
ansible 2.2.0 (devel 6f678e36d6) last updated 2016/08/23 09:52:36 (GMT +300)
  lib/ansible/modules/core: (devel 91a839f1e3) last updated 2016/08/18 20:46:51 (GMT +300)
  lib/ansible/modules/extras: (detached HEAD 1aeb9f8a8c) last updated 2016/08/23 09:03:03 (GMT +300)
  config file = 
  configured module search path = Default w/o overrides
OS / ENVIRONMENT

Ubuntu 16.04

SUMMARY

My role task that uses with_fileglob: [ prefix-* ] fails to match files in role/files/prefix-* and emits a warning. Here's the task:

# roles/fridge/tasks/triggers.yml
- name: /usr/local/sbin/pov-trigger-* scripts
  copy: src={{ item }} dest=/usr/local/sbin/{{ item|basename }} mode=0755
  tags: triggers
  with_fileglob:
    - pov-trigger-*

Here's what in roles/fridge/files/:

$ ls roles/fridge/files/pov-trigger-*
roles/fridge/files/pov-trigger-root-tasks  roles/fridge/files/pov-trigger-update-fridge.pov.lt

Here's the ansible output:

TASK [fridge : /usr/local/sbin/pov-trigger-* scripts] **************************
 [WARNING]: Invalid request to find a file that matches an empty string or "null" value

This used to work fine in Ansible 2.1.1.0.

STEPS TO REPRODUCE
# test.yml
- hosts: localhost
  gather_facts: no
  tasks:
    - debug: msg={{ item }}
      with_fileglob:
        - prfx-*
$ tree
.
├── files
│   ├── prfx-a
│   ├── prfx-b
│   └── unrelated
├── Makefile
└── test.yml
$ ansible-playbook -i localhost, test.yml
EXPECTED RESULTS
PLAY [localhost] ***************************************************************

TASK [debug] *******************************************************************
ok: [localhost] => (item=/home/mg/src/bugs/ansible-bug-17192/files/prfx-a) => {
    "item": "/home/mg/src/bugs/ansible-bug-17192/files/prfx-a", 
    "msg": "/home/mg/src/bugs/ansible-bug-17192/files/prfx-a"
}
ok: [localhost] => (item=/home/mg/src/bugs/ansible-bug-17192/files/prfx-b) => {
    "item": "/home/mg/src/bugs/ansible-bug-17192/files/prfx-b", 
    "msg": "/home/mg/src/bugs/ansible-bug-17192/files/prfx-b"
}

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0   
ACTUAL RESULTS
PLAY [localhost] ***************************************************************

TASK [debug] *******************************************************************
 [WARNING]: Invalid request to find a file that matches an empty string or "null" value


PLAY RECAP *********************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=0   
@mgedmin
Copy link
Contributor Author

mgedmin commented Aug 23, 2016

AFAICT fileglob with subdir/pattern works fine, but fileglob without a subdir is broken.

@abadger abadger added this to the 2.2.0 milestone Aug 23, 2016
@abadger abadger added bug_report P2 Priority 2 - Issue Blocks Release labels Aug 23, 2016
@ansibot ansibot added triage affects_2.2 This issue/PR affects Ansible v2.2 labels Sep 7, 2016
@bcoca bcoca removed the triage label Sep 9, 2016
@jimi-c jimi-c closed this as completed in c9d3d2b Sep 21, 2016
@jimi-c
Copy link
Member

jimi-c commented Sep 21, 2016

Closing This Ticket

Hi!

We believe the above commit should resolve this problem for you. This will also be included in the next release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular issue is resolved.

Thank you!

@biroeng
Copy link

biroeng commented Dec 9, 2016

We really need to clarify by example how to resolve this issue
We need to tell you have to specify , from where you run playbook , and look to the file in reference to the command

sereinity pushed a commit to sereinity-forks/ansible that referenced this issue Jan 25, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

No branches or pull requests

6 participants