Skip to content

Commit

Permalink
Fix issue in ipv4_hex
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwini-mhatre committed Jul 17, 2023
1 parent 6b186d5 commit df89d74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/Bugfix_ipv4_hex.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Validate input for ipv4_hex(https://github.com/ansible-collections/ansible.utils/issues/281)
10 changes: 10 additions & 0 deletions tests/integration/targets/utils_ipaddr_filter/tasks/ip4_hex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,13 @@
- name: Assert result for ip4_hex.
ansible.builtin.assert:
that: "{{ result1 == 'c0:a8:01:05' }}"

- name: Ip4_hex validate input
ansible.builtin.set_fact:
result1: "{{ '555.444.333.999'|ansible.utils.ip4_hex }}"
register: output
ignore_errors: true

- name: Assert result for ip4_hex.
ansible.builtin.assert:
that: "{{ 'You must pass a valid IP address; 555.444.333.999 is invalid' in output.msg }}"

0 comments on commit df89d74

Please sign in to comment.