mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-08-01 04:14:42 +00:00
Merge pull request #1225 from rjeffman/ci_pin_ansible_lint_version
Bump linter tools versions an fix linter errors
This commit is contained in:
2
.github/workflows/ansible-test.yml
vendored
2
.github/workflows/ansible-test.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
|||||||
name: Verify ansible-test sanity
|
name: Verify ansible-test sanity
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Run ansible-test
|
- name: Run ansible-test
|
||||||
|
|||||||
24
.github/workflows/docs.yml
vendored
24
.github/workflows/docs.yml
vendored
@@ -8,10 +8,10 @@ jobs:
|
|||||||
name: Check Ansible Documentation with ansible-core 2.13.
|
name: Check Ansible Documentation with ansible-core 2.13.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- name: Install Ansible 2.13
|
- name: Install Ansible 2.13
|
||||||
@@ -25,10 +25,10 @@ jobs:
|
|||||||
name: Check Ansible Documentation with ansible-core 2.14.
|
name: Check Ansible Documentation with ansible-core 2.14.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- name: Install Ansible 2.14
|
- name: Install Ansible 2.14
|
||||||
@@ -42,10 +42,10 @@ jobs:
|
|||||||
name: Check Ansible Documentation with ansible-core 2.15.
|
name: Check Ansible Documentation with ansible-core 2.15.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- name: Install Ansible 2.15
|
- name: Install Ansible 2.15
|
||||||
@@ -59,10 +59,10 @@ jobs:
|
|||||||
name: Check Ansible Documentation with latest Ansible version.
|
name: Check Ansible Documentation with latest Ansible version.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
- name: Install Ansible-latest
|
- name: Install Ansible-latest
|
||||||
|
|||||||
34
.github/workflows/lint.yml
vendored
34
.github/workflows/lint.yml
vendored
@@ -8,15 +8,15 @@ jobs:
|
|||||||
name: Verify ansible-lint
|
name: Verify ansible-lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- name: Run ansible-lint
|
- name: Run ansible-lint
|
||||||
run: |
|
run: |
|
||||||
pip install "ansible-core>=2.16,<2.17" 'ansible-lint>=6.22'
|
pip install "ansible-core>=2.16,<2.17" 'ansible-lint==6.22'
|
||||||
utils/build-galaxy-release.sh -ki
|
utils/build-galaxy-release.sh -ki
|
||||||
cd .galaxy-build
|
cd .galaxy-build
|
||||||
ansible-lint --profile production --exclude tests/integration/ --exclude tests/unit/ --parseable --nocolor
|
ansible-lint --profile production --exclude tests/integration/ --exclude tests/unit/ --parseable --nocolor
|
||||||
@@ -25,10 +25,10 @@ jobs:
|
|||||||
name: Verify yamllint
|
name: Verify yamllint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- name: Run yaml-lint
|
- name: Run yaml-lint
|
||||||
@@ -38,10 +38,10 @@ jobs:
|
|||||||
name: Verify pydocstyle
|
name: Verify pydocstyle
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- name: Run pydocstyle
|
- name: Run pydocstyle
|
||||||
@@ -53,10 +53,10 @@ jobs:
|
|||||||
name: Verify flake8
|
name: Verify flake8
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- name: Run flake8
|
- name: Run flake8
|
||||||
@@ -68,10 +68,10 @@ jobs:
|
|||||||
name: Verify pylint
|
name: Verify pylint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- uses: actions/setup-python@v4.3.0
|
- uses: actions/setup-python@v5.1.0
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- name: Run pylint
|
- name: Run pylint
|
||||||
@@ -83,8 +83,8 @@ jobs:
|
|||||||
name: Shellcheck
|
name: Shellcheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- name: Run ShellCheck
|
- name: Run ShellCheck
|
||||||
uses: ludeeus/action-shellcheck@master
|
uses: ludeeus/action-shellcheck@master
|
||||||
|
|||||||
4
.github/workflows/readme.yml
vendored
4
.github/workflows/readme.yml
vendored
@@ -8,9 +8,9 @@ jobs:
|
|||||||
name: Verify readme
|
name: Verify readme
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3.1.0
|
- uses: actions/checkout@v4.1.1
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 1
|
||||||
- name: Run readme test
|
- name: Run readme test
|
||||||
run: |
|
run: |
|
||||||
error=0
|
error=0
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/ansible/ansible-lint.git
|
- repo: https://github.com/ansible/ansible-lint.git
|
||||||
rev: v6.22.0
|
rev: v24.5.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: ansible-lint
|
- id: ansible-lint
|
||||||
always_run: false
|
always_run: false
|
||||||
@@ -21,20 +21,20 @@ repos:
|
|||||||
--parseable
|
--parseable
|
||||||
--nocolor
|
--nocolor
|
||||||
- repo: https://github.com/adrienverge/yamllint.git
|
- repo: https://github.com/adrienverge/yamllint.git
|
||||||
rev: v1.32.0
|
rev: v1.35.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: yamllint
|
- id: yamllint
|
||||||
files: \.(yaml|yml)$
|
files: \.(yaml|yml)$
|
||||||
- repo: https://github.com/pycqa/flake8
|
- repo: https://github.com/pycqa/flake8
|
||||||
rev: 6.0.0
|
rev: 7.0.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/pycqa/pydocstyle
|
- repo: https://github.com/pycqa/pydocstyle
|
||||||
rev: 6.0.0
|
rev: 6.3.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pydocstyle
|
- id: pydocstyle
|
||||||
- repo: https://github.com/pycqa/pylint
|
- repo: https://github.com/pycqa/pylint
|
||||||
rev: v3.0.2
|
rev: v3.2.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
args:
|
args:
|
||||||
|
|||||||
@@ -499,7 +499,10 @@ def module_params_get(module, name, allow_empty_list_item=False):
|
|||||||
# Ansible issue https://github.com/ansible/ansible/issues/77108
|
# Ansible issue https://github.com/ansible/ansible/issues/77108
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
for val in value:
|
for val in value:
|
||||||
if isinstance(val, (str, unicode)) and not val:
|
if (
|
||||||
|
isinstance(val, (str, unicode)) # pylint: disable=W0012,E0606
|
||||||
|
and not val
|
||||||
|
):
|
||||||
if not allow_empty_list_item:
|
if not allow_empty_list_item:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Parameter '%s' contains an empty string" %
|
msg="Parameter '%s' contains an empty string" %
|
||||||
|
|||||||
@@ -450,6 +450,10 @@ def main():
|
|||||||
commands = []
|
commands = []
|
||||||
|
|
||||||
for name in names:
|
for name in names:
|
||||||
|
_type = None
|
||||||
|
inclusive_add, inclusive_del = [], []
|
||||||
|
exclusive_add, exclusive_del = [], []
|
||||||
|
|
||||||
# Make sure automember rule exists
|
# Make sure automember rule exists
|
||||||
res_find = find_automember(ansible_module, name, automember_type)
|
res_find = find_automember(ansible_module, name, automember_type)
|
||||||
|
|
||||||
@@ -495,16 +499,12 @@ def main():
|
|||||||
transform_conditions(inclusive),
|
transform_conditions(inclusive),
|
||||||
res_find.get("automemberinclusiveregex", [])
|
res_find.get("automemberinclusiveregex", [])
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
inclusive_add, inclusive_del = [], []
|
|
||||||
|
|
||||||
if exclusive is not None:
|
if exclusive is not None:
|
||||||
exclusive_add, exclusive_del = gen_add_del_lists(
|
exclusive_add, exclusive_del = gen_add_del_lists(
|
||||||
transform_conditions(exclusive),
|
transform_conditions(exclusive),
|
||||||
res_find.get("automemberexclusiveregex", [])
|
res_find.get("automemberexclusiveregex", [])
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
exclusive_add, exclusive_del = [], []
|
|
||||||
|
|
||||||
elif action == "member":
|
elif action == "member":
|
||||||
if res_find is None:
|
if res_find is None:
|
||||||
@@ -512,9 +512,7 @@ def main():
|
|||||||
msg="No automember '%s'" % name)
|
msg="No automember '%s'" % name)
|
||||||
|
|
||||||
inclusive_add = transform_conditions(inclusive or [])
|
inclusive_add = transform_conditions(inclusive or [])
|
||||||
inclusive_del = []
|
|
||||||
exclusive_add = transform_conditions(exclusive or [])
|
exclusive_add = transform_conditions(exclusive or [])
|
||||||
exclusive_del = []
|
|
||||||
|
|
||||||
for _inclusive in inclusive_add:
|
for _inclusive in inclusive_add:
|
||||||
key, regex = _inclusive.split("=", 1)
|
key, regex = _inclusive.split("=", 1)
|
||||||
|
|||||||
@@ -250,6 +250,8 @@ def main():
|
|||||||
operation = "add"
|
operation = "add"
|
||||||
|
|
||||||
invalid = []
|
invalid = []
|
||||||
|
wants_enable = False
|
||||||
|
|
||||||
if state in ["enabled", "disabled"]:
|
if state in ["enabled", "disabled"]:
|
||||||
if action == "member":
|
if action == "member":
|
||||||
ansible_module.fail_json(
|
ansible_module.fail_json(
|
||||||
|
|||||||
@@ -1605,6 +1605,8 @@ def main():
|
|||||||
|
|
||||||
res_find = find_dnsrecord(ansible_module, zone_name, name)
|
res_find = find_dnsrecord(ansible_module, zone_name, name)
|
||||||
|
|
||||||
|
cmds = []
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
cmds = define_commands_for_present_state(
|
cmds = define_commands_for_present_state(
|
||||||
ansible_module, zone_name, entry, res_find)
|
ansible_module, zone_name, entry, res_find)
|
||||||
|
|||||||
@@ -663,7 +663,11 @@ def main():
|
|||||||
|
|
||||||
check_parameters(ansible_module, state, action)
|
check_parameters(ansible_module, state, action)
|
||||||
|
|
||||||
elif isinstance(group_name, (str, unicode)):
|
elif (
|
||||||
|
isinstance(
|
||||||
|
group_name, (str, unicode) # pylint: disable=W0012,E0606
|
||||||
|
)
|
||||||
|
):
|
||||||
name = group_name
|
name = group_name
|
||||||
else:
|
else:
|
||||||
ansible_module.fail_json(msg="Group '%s' is not valid" %
|
ansible_module.fail_json(msg="Group '%s' is not valid" %
|
||||||
|
|||||||
@@ -988,7 +988,9 @@ def main():
|
|||||||
sshpubkey = [str(normalize_sshpubkey(key)) for
|
sshpubkey = [str(normalize_sshpubkey(key)) for
|
||||||
key in sshpubkey]
|
key in sshpubkey]
|
||||||
|
|
||||||
elif isinstance(host, (str, unicode)):
|
elif (
|
||||||
|
isinstance(host, (str, unicode)) # pylint: disable=W0012,E0606
|
||||||
|
):
|
||||||
name = host
|
name = host
|
||||||
else:
|
else:
|
||||||
ansible_module.fail_json(msg="Host '%s' is not valid" %
|
ansible_module.fail_json(msg="Host '%s' is not valid" %
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ def result_get_value_lowercase(res_find, key, default=None):
|
|||||||
if existing is not None:
|
if existing is not None:
|
||||||
if isinstance(existing, (list, tuple)):
|
if isinstance(existing, (list, tuple)):
|
||||||
existing = [to_text(item).lower() for item in existing]
|
existing = [to_text(item).lower() for item in existing]
|
||||||
if isinstance(existing, (str, unicode)):
|
if isinstance(existing, (str, unicode)): # pylint: disable=W0012,E0606
|
||||||
existing = existing.lower()
|
existing = existing.lower()
|
||||||
else:
|
else:
|
||||||
existing = default
|
existing = default
|
||||||
|
|||||||
@@ -693,7 +693,11 @@ def main():
|
|||||||
|
|
||||||
delete_continue = service.get("delete_continue")
|
delete_continue = service.get("delete_continue")
|
||||||
|
|
||||||
elif isinstance(service, (str, unicode)):
|
elif (
|
||||||
|
isinstance(
|
||||||
|
service, (str, unicode) # pylint: disable=W0012,E0606
|
||||||
|
)
|
||||||
|
):
|
||||||
name = service
|
name = service
|
||||||
else:
|
else:
|
||||||
ansible_module.fail_json(msg="Service '%s' is not valid" %
|
ansible_module.fail_json(msg="Service '%s' is not valid" %
|
||||||
|
|||||||
@@ -1382,7 +1382,11 @@ def main():
|
|||||||
|
|
||||||
email = extend_emails(email, default_email_domain)
|
email = extend_emails(email, default_email_domain)
|
||||||
|
|
||||||
elif isinstance(user, (str, unicode)):
|
elif (
|
||||||
|
isinstance(
|
||||||
|
user, (str, unicode) # pylint: disable=W0012,E0606
|
||||||
|
)
|
||||||
|
):
|
||||||
name = user
|
name = user
|
||||||
else:
|
else:
|
||||||
ansible_module.fail_json(msg="User '%s' is not valid" %
|
ansible_module.fail_json(msg="User '%s' is not valid" %
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
-r requirements-tests.txt
|
-r requirements-tests.txt
|
||||||
ipdb==0.13.4
|
ipdb==0.13.4
|
||||||
pre-commit==2.20.0
|
pre-commit==2.20.0
|
||||||
flake8==6.0.0
|
flake8==7.0.0
|
||||||
flake8-bugbear
|
flake8-bugbear
|
||||||
pylint==2.17.2
|
pylint>=3.2
|
||||||
wrapt==1.14.1
|
wrapt==1.14.1
|
||||||
pydocstyle==6.3.0
|
pydocstyle==6.3.0
|
||||||
yamllint==1.32.0
|
yamllint==1.35.1
|
||||||
ansible-lint >= 6.22
|
ansible-lint>=24.5.0
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ def main():
|
|||||||
conn.connect(ccache=installer._ccache)
|
conn.connect(ccache=installer._ccache)
|
||||||
remote_api.Command['hostgroup_add_member'](
|
remote_api.Command['hostgroup_add_member'](
|
||||||
u'ipaservers',
|
u'ipaservers',
|
||||||
host=[unicode(api.env.host)],
|
host=[unicode(api.env.host)], # pylint: disable=W0012,E0606
|
||||||
)
|
)
|
||||||
finally:
|
finally:
|
||||||
if conn.isconnected():
|
if conn.isconnected():
|
||||||
|
|||||||
@@ -658,7 +658,7 @@ def main():
|
|||||||
# Check authorization
|
# Check authorization
|
||||||
result = remote_api.Command['hostgroup_find'](
|
result = remote_api.Command['hostgroup_find'](
|
||||||
cn=u'ipaservers',
|
cn=u'ipaservers',
|
||||||
host=[unicode(api.env.host)]
|
host=[unicode(api.env.host)] # pylint: disable=W0012,E0606
|
||||||
)['result']
|
)['result']
|
||||||
add_to_ipaservers = not result
|
add_to_ipaservers = not result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user