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

Misleading warning "is not valid under any of the given schemas" when linting tasks #2888

Closed
boutetnico opened this issue Jan 12, 2023 · 1 comment · Fixed by #2912
Closed
Assignees
Labels
bug new Triage required

Comments

@boutetnico
Copy link

Summary

I have a task file that is imported by a top-level playbook.
Ansible-lint reports a warning when checking the following file whereas I believe it is mistaken because the task works as expected. I suspect the environment key to cause the warning.

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint 6.10.2 using ansible 2.14.1
  • ansible installation method: pip
  • ansible-lint installation method: pip
  • OS: macOS 12.6.1
STEPS TO REPRODUCE

Create the following test.yml file inside a tasks folder.

---
- name: Run npm run prod
  ansible.builtin.command: npm run prod
  environment:
    DISABLE_V8_COMPILE_CACHE: 1
  changed_when: false

Run ansible-lint:

ansible-lint tasks/test.yml
Desired Behavior

No warning is issued.

Actual Behavior

A warning is issued.
ansible-lint-warning

@alqu
Copy link

alqu commented Aug 29, 2023

I am running ansible-lint v6.18.0 and have exactly the same bug. So not solved:

STEPS TO REPRODUCE

- name:         Check some command
  ansible.builtin.command:
    cmd:        "someCommand"
  environment:
    my_env_var: 1
  register:     command_result
  failed_when:  command_result.rc > 2
  changed_when: command_result.stdout != ''

Desired Behavior

No warning is issued.

Actual Behavior

A warning is issued.

WARNING  Listing 1 violation(s) that are fatal
schema[tasks]: {'name': 'Check some command', 'ansible.builtin.command': {'cmd': 'someCommand'}, 'environment': {'my_env_var': 1}, 'register': 'command_result', 'failed_when': 'command_result.rc > 2', 'changed_when': "command_result.stdout != ''"} is not valid under any of the given schemas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug new Triage required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants