Skip to content
This repository has been archived by the owner on Jan 8, 2023. It is now read-only.

Commit

Permalink
Enable use of ansible-lint
Browse files Browse the repository at this point in the history
- enable ansible-lint
- fix reported issues
- bump other linters
  • Loading branch information
ssbarnea committed Jun 16, 2021
1 parent a3147e7 commit fc56738
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
18 changes: 11 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ exclude: |
)
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.6.4
rev: 5.8.0
hooks:
- id: isort
- repo: https://github.com/python/black.git
rev: 20.8b1
rev: 21.6b0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v3.3.0
rev: v4.0.1
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand All @@ -25,7 +25,7 @@ repos:
- id: debug-statements
language_version: python3
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.8.4
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -35,14 +35,14 @@ repos:
- flake8-docstrings>=1.5.0
language_version: python3
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.25.0
rev: v1.26.1
hooks:
- id: yamllint
files: \.(yaml|yml)$
types: [file, yaml]
entry: yamllint --strict
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.790
rev: v0.902
hooks:
- id: mypy
# empty args needed in order to match mypy cli behavior
Expand All @@ -54,10 +54,14 @@ repos:
- molecule
- packaging
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.6.0
rev: v3.0.0a3
hooks:
- id: pylint
additional_dependencies:
- ansible-core>=2.11.1
- ansible-lint>=5.1.0a0
- molecule
- repo: https://github.com/ansible/ansible-lint.git
rev: v5.1.0a0
hooks:
- id: ansible-lint
15 changes: 11 additions & 4 deletions lib/molecule_podman/playbooks/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
- not item.pre_build_image | default(false)
register: podman_images

- name: Build an Ansible compatible image
- name: Build an Ansible compatible image # noqa: no-handler
command: >
podman build
-f {{ item.dest }}
Expand Down Expand Up @@ -95,9 +95,16 @@

# https://github.com/ansible-community/molecule-podman/issues/22
- name: Remove possible pre-existing containers
shell: >
podman container exists {{ item.name }} && podman rm {{ item.name }} -f || true
shell: |
set -e
podman container exists {{ item.name }} && {
podman rm {{ item.name }} -f
echo "Container removed"
}
with_items: "{{ molecule_yml.platforms }}"
register: result
changed_when: '"Container removed" in result.stdout'
failed_when: false
loop_control:
label: "{{ item.name }}"

Expand Down Expand Up @@ -169,4 +176,4 @@
retries: 300
with_items: "{{ server.results }}"
loop_control:
label: "{{ item.item.name | default('Unnamed')}}"
label: "{{ item.item.name | default('Unnamed') }}"
5 changes: 4 additions & 1 deletion lib/molecule_podman/playbooks/validate-dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
template:
src: Dockerfile.j2
dest: "{{ temp_image_dirs.results[index].path }}/Dockerfile"
mode: 0600
register: result
with_items: "{{ platforms }}"
loop_control:
Expand All @@ -52,4 +53,6 @@
state: absent
loop: "{{ temp_image_dirs.results | map(attribute='path') | list }}"

- debug: var=result
- name: Display result
debug:
var: result

0 comments on commit fc56738

Please sign in to comment.