Fix CI (#314)
* 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
parent
4e88e4fe03
commit
8d822ed9d7
|
@ -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 }}'
|
||||
])"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Ansible Utilities Collection
|
||||
[](https://codecov.io/gh/ansible-collections/ansible.utils)
|
||||
[](https://github.com/ansible-collections/ansible.utils/actions/workflows/test.yml)
|
||||
[](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.
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 }}"
|
||||
|
|
Loading…
Reference in New Issue