-
Notifications
You must be signed in to change notification settings - Fork 122
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
Introduce ansible-lint to format ansible files #2666
Conversation
59ec0db
to
31d6a90
Compare
/packit test -i full |
6b57e8a
to
843a4d4
Compare
This is proposed by Martin. For details, please refer to: #2666 (comment) Signed-off-by: Vector Li <huanli@redhat.com>
In patch eee8f619, file examples/redis/ansible/tasks/redis.yml is excluded because of a failure which doesn't comply with rule schema. e.g. $ pre-commit run --all-files ansible-lint
Ansible-lint.............................................................Failed
- hook id: ansible-lint
- exit code: 2
...<snip>...
INFO Executing syntax check on playbook tests/run/worktree/data/ansible/playbook.yml (0.61s)
WARNING Ignored exception from VariableNamingRule.<bound method VariableNamingRule.matchyaml of var-naming: All variables should be named using only lowercase and underscores.> while processing examples/redis/ansible/setup_server.yml (playbook): list indices must be integers or slices, not str
WARNING Listing 1 violation(s) that are fatal
�]8;id=251359;https://ansible.readthedocs.io/projects/lint/rules/schema/�\schema[playbook]�]8;;�\: $[0].vars [{'version': '{{ ansible_distribution_version }}'}] is not of type 'object'
examples/redis/ansible/setup_server.yml:1 Returned errors will not include exact line numbers, but they will mention
the schema name being used as a tag, like ``schema[playbook]``,
``schema[tasks]``.
This rule is not skippable and stops further processing of the file.
If incorrect schema was picked, you might want to either:
* move the file to standard location, so its file is detected correctly.
* use ``kinds:`` option in linter config to help it pick correct file type.
Read �]8;id=797634;https://ansible.readthedocs.io/projects/lint/configuring/#ignoring-rules-for-entire-files�\documentation�]8;;�\ for instructions on how to ignore specific rule violations.
Rule Violation Summary
count tag profile rule associated tags
1 �]8;id=577568;https://ansible.readthedocs.io/projects/lint/rules/schema�\schema[playbook]�]8;;�\ basic core
Failed: 1 failure(s), 0 warning(s) on 22 files. Profile 'production' was required, but 'min' profile passed. And I had a try to find possible solution to fix the failure, e.g. ansible-lint/issues/2230, but I failed. @martinhoyer, @thrix and @happz, if you have idea to fix the failure, please let me know, thanks! |
@idorax I suspect it's just a matter of removing the dash.
|
eee8f61
to
e8a1d35
Compare
Thanks, it works fine now. |
This is proposed by Martin. For details, please refer to: #2666 (comment) Signed-off-by: Vector Li <huanli@redhat.com>
e89bf32
to
29e6fc5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me :)
This is proposed by Martin. For details, please refer to: #2666 (comment) Signed-off-by: Vector Li <huanli@redhat.com>
29e6fc5
to
01db3cb
Compare
|
Hi @lukaszachy, is there anything I can do? BTW, the failure from testing-farm:fedora-39-x86_64:provision is because of
|
This is proposed by Martin. For details, please refer to: #2666 (comment) Signed-off-by: Vector Li <huanli@redhat.com>
01db3cb
to
fd7a72b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I just run into one question/bug during the review. It was present before but I guess we could/should fix it while we're doing the changes here.
Add ansible-lint to the pre-commit-config file, and fix failures/warnings for ansible files as well. Signed-off-by: Vector Li <huanli@redhat.com>
63b1c04
to
4ad9ce6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, now looks good!
Pull Request Checklist
Fixes: #2664