Debian Codegraph @

ansible_collections/community/windows/tests/integration/targets/win_psscript_info/tasks/common.yml

raw
1 # This file is part of Ansible
2
3 # Copyright: (c) 2020, Brian Scholer <@briantist>
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5 ---
6 - name: Assert that the correct structure is returned {{ suffix }}
7 assert:
8 that:
9 - script_info.scripts is defined
10 - script_info.scripts is sequence()
11 quiet: yes
12
13 - name: Assert that the correct number of scripts are returned {{ suffix }}
14 assert:
15 that: script_info.scripts | length >= expected_scripts | length
16 fail_msg: >-
17 Expected {{ expected_scripts | length }} scripts, got {{ script_info.scripts | map(attribute='name') | join(',') }} ({{ script_info.scripts | length}})
18 quiet: yes
19
20 - name: Assert that all expected scripts are present {{ suffix }}
21 assert:
22 that: item in (script_info.scripts | map(attribute='name'))
23 fail_msg: "Expected script '{{ item }}' not found in results."
24 quiet: yes
25 loop: "{{ expected_scripts }}"
26 loop_control:
27 label: "Assert '{{ item }}' in result."
28
29 - include_tasks: contains_all_fields.yml
30 vars:
31 dict_to_check: "{{ item }}"
32 loop: "{{
33 only_check_first
34 | default(True)
35 | bool
36 | ternary([ script_info.scripts[0] ], script_info.scripts)
37 }}"