* Fix syntax

* Fix tests

* Fix

* Fix

* Delete tests/integration/inventory

* Update module.yaml

* Update module.yaml

* Make config validate work after core updates

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Fix tests

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

* Another test fix and README update

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>

---------

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
Co-authored-by: Ashwini Mhatre <amhatre@amhatre-thinkpadt14sgen2i.pnq.csb>
Co-authored-by: NilashishC <nilashishchakraborty8@gmail.com>
pull/309/head
Ashwini Mhatre 2023-11-30 12:28:27 +05:30 committed by GitHub
parent 4e88e4fe03
commit 8d822ed9d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View File

@ -28,6 +28,7 @@ jobs:
all_green:
if: ${{ always() }}
needs:
- ansible-lint
- changelog
- integration
- sanity
@ -39,7 +40,7 @@ jobs:
set([
'${{ needs.ansible-lint.result }}',
'${{ needs.changelog.result }}',
'${{ needs.integration.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}',
'${{ needs.unit-source.result }}'
'${{ needs.unit-galaxy.result }}'
])"

View File

@ -1,6 +1,6 @@
# Ansible Utilities Collection
[![Codecov](https://codecov.io/gh/ansible-collections/ansible.utils/branch/main/graph/badge.svg)](https://codecov.io/gh/ansible-collections/ansible.utils)
[![CI](https://github.com/ansible-collections/ansible.utils/actions/workflows/test.yml/badge.svg?branch=main&event=schedule)](https://github.com/ansible-collections/ansible.utils/actions/workflows/test.yml)
[![CI](https://github.com/ansible-collections/ansible.utils/actions/workflows/tests.yml/badge.svg?branch=main&event=schedule)](https://github.com/ansible-collections/ansible.utils/actions/workflows/tests.yml)
The Ansible ``ansible.utils`` collection includes a variety of plugins that aid in the management, manipulation and visibility of data for the Ansible playbook developer.

View File

@ -48,6 +48,8 @@ EXAMPLES = r"""
import re
from io import StringIO
from ansible.errors import AnsibleError
from ansible.module_utils._text import to_text
from ansible.module_utils.six import string_types
@ -87,7 +89,7 @@ class Validate(ValidateBase):
try:
if isinstance(self._criteria, string_types):
self._criteria = yaml.load(str(self._criteria), Loader=SafeLoader)
self._criteria = yaml.load(StringIO(self._criteria), Loader=SafeLoader)
except yaml.parser.ParserError as exc:
msg = (
"'criteria' option value is invalid, value should be valid YAML."
@ -105,7 +107,9 @@ class Validate(ValidateBase):
issues.append('Criteria {item} missing "action" key'.format(item=item))
elif item["action"] not in ("warn", "fail"):
issues.append(
'Action in criteria {item} is not one of "warn" or "fail"'.format(item=item),
'Action in criteria {item} is not one of "warn" or "fail"'.format(
item=item,
),
)
if "rule" not in item:
issues.append('Criteria {item} missing "rule" key'.format(item=item))
@ -159,7 +163,9 @@ class Validate(ValidateBase):
warnings.append(format_message(match, line_number, criteria))
if criteria["action"] == "fail":
errors.append({"message": criteria["name"], "found": line})
error_messages.append(format_message(match, line_number, criteria))
error_messages.append(
format_message(match, line_number, criteria),
)
if errors:
if "errors" not in self._result:

View File

@ -16,7 +16,7 @@
ansible.builtin.assert:
that:
- "{{ POpqMQoJWTiDpEW is defined }}"
- "{{ nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"
- nxos_ttp_text['parsed'][0][0] | selectattr('interface', 'search', 'mgmt0') | list | length
- "{{ nxos_ttp_text['parsed'] == nxos_ttp_text_parsed }}"
- name: "Pass text and custom variable {{ parser }}"
@ -49,6 +49,6 @@
- name: "Confirm modified results {{ parser }}"
ansible.builtin.assert:
that: "{{ item }}"
that: item
with_items:
- "{{ (nxos_ttp_results['parsed'][0] | from_yaml)[0] | selectattr('interface', 'search', 'mgmt0') | list | length }}"