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

Schema: complex_conditional doesn't support raw booleans in lists #3105

Closed
bendem opened this issue Mar 1, 2023 · 0 comments · Fixed by #3109
Closed

Schema: complex_conditional doesn't support raw booleans in lists #3105

bendem opened this issue Mar 1, 2023 · 0 comments · Fixed by #3109
Assignees
Labels

Comments

@bendem
Copy link
Contributor

bendem commented Mar 1, 2023

Summary

complex_conditional (when, changed_when, etc.) supports literal booleans in "value form" and in "list form", but the schema doesn't.

"complex_conditional": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
]
},

Issue Type
  • Bug Report
OS / ENVIRONMENT
ansible-lint --version
ansible-lint 6.13.1 using ansible 2.14.3

> python --version                                                                                                     
Python 3.9.13

> cat /etc/os-release                   
NAME="Rocky Linux"
VERSION="8.7 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.7 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.7"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.7"
STEPS TO REPRODUCE
- name: test
  hosts: localhost
  # hosts: all
  gather_facts: false
  tasks:
    - 
    - ansible.builtin.debug:
        msg: "this is ok"
      when:
        - true
Desired Behavior
> ansible-lint -p _test.yml

Passed with production profile: 0 failure(s), 0 warning(s) on 1 files.
Actual Behavior
> ansible-lint -p _test.yml
WARNING  Ignored exception from UseHandlerRatherThanWhenChangedRule.<bound method AnsibleLintRule.matchtasks of no-handler: Tasks that run when changed should likely be handlers.> while processing _test.yml (playbook): 'bool' object has no attribute 'split'
WARNING  Listing 1 violation(s) that are fatal
_test.yml:1: schema[playbook]: {'name': 'test', 'ansible.builtin.debug': {'msg': 'this is ok'}, 'when': [True]} is not valid under any of the given schemas
Read documentation for instructions on how to ignore specific rule violations.

               Rule Violation Summary                
 count tag              profile rule associated tags 
     1 schema[playbook] basic   core                 

Failed after min profile: 1 failure(s), 0 warning(s) on 1 files.
@bendem bendem added bug new Triage required labels Mar 1, 2023
@audgirka audgirka self-assigned this Mar 1, 2023
@audgirka audgirka removed the new Triage required label Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants