Skip to content

Commit

Permalink
[PR #6152/11c7611c backport][stable-6] More true/false normalization (#…
Browse files Browse the repository at this point in the history
…6153)

More true/false normalization (#6152)

* More true/false normalization.

* Boolean do not need explicit choices.

* One more.

* Fix type argument.

(cherry picked from commit 11c7611)

Co-authored-by: Felix Fontein <[email protected]>
  • Loading branch information
patchback[bot] and felixfontein authored Mar 7, 2023
1 parent 186b420 commit 47514e1
Show file tree
Hide file tree
Showing 48 changed files with 203 additions and 219 deletions.
2 changes: 1 addition & 1 deletion plugins/modules/aix_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
device: en1
attributes:
mtu: 900
arp: off
arp: 'off'
state: available
- name: Configure IP, netmask and set en1 up.
Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/ipmi_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
description: The current power state of the machine.
returned: success and I(machine) is not provided
type: str
sample: on
sample: 'on'
status:
description: The current power state of the machine when the machine option is set.
returned: success and I(machine) is provided
Expand Down Expand Up @@ -132,14 +132,14 @@
name: test.testdomain.com
user: admin
password: password
state: on
state: 'on'
- name: Ensure machines of which remote target address is 48 and 50 are powered off
community.general.ipmi_power:
name: test.testdomain.com
user: admin
password: password
state: off
state: 'off'
machine:
- targetAddress: 48
- targetAddress: 50
Expand All @@ -151,9 +151,9 @@
password: password
machine:
- targetAddress: 48
state: on
state: 'on'
- targetAddress: 50
state: off
state: 'off'
'''

import traceback
Expand Down
1 change: 0 additions & 1 deletion plugins/modules/nmcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,6 @@
- Enable or disable IPSec tunnel to L2TP host.
- This option is need when C(service-type) is C(org.freedesktop.NetworkManager.l2tp).
type: bool
choices: [ yes, no ]
ipsec-psk:
description:
- The pre-shared key in base64 encoding.
Expand Down
25 changes: 5 additions & 20 deletions plugins/modules/utm_proxy_auth_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,6 @@
- Should the login data be stripped when proxying the request to the backend host
type: bool
default: true
choices:
- True
- False
backend_user_prefix:
type: str
description:
Expand Down Expand Up @@ -118,9 +115,6 @@
- Allow session persistency
type: bool
default: false
choices:
- True
- False
frontend_session_lifetime:
type: int
description:
Expand All @@ -131,9 +125,6 @@
- Specifies if limitation of session lifetime is active
type: bool
default: true
choices:
- True
- False
frontend_session_lifetime_scope:
type: str
description:
Expand All @@ -153,9 +144,6 @@
- Specifies if session timeout is active
type: bool
default: true
choices:
- True
- False
frontend_session_timeout_scope:
type: str
description:
Expand Down Expand Up @@ -184,9 +172,6 @@
- Should a redirect to the requested URL be made
type: bool
default: false
choices:
- True
- False
extends_documentation_fragment:
- community.general.utm
Expand Down Expand Up @@ -336,7 +321,7 @@ def main():
aaa=dict(type='list', elements='str', required=True),
basic_prompt=dict(type='str', required=True),
backend_mode=dict(type='str', required=False, default="None", choices=['Basic', 'None']),
backend_strip_basic_auth=dict(type='bool', required=False, default=True, choices=[True, False]),
backend_strip_basic_auth=dict(type='bool', required=False, default=True),
backend_user_prefix=dict(type='str', required=False, default=""),
backend_user_suffix=dict(type='str', required=False, default=""),
comment=dict(type='str', required=False, default=""),
Expand All @@ -348,16 +333,16 @@ def main():
frontend_logout=dict(type='str', required=False),
frontend_mode=dict(type='str', required=False, default="Basic", choices=['Basic', 'Form']),
frontend_realm=dict(type='str', required=False),
frontend_session_allow_persistency=dict(type='bool', required=False, default=False, choices=[True, False]),
frontend_session_allow_persistency=dict(type='bool', required=False, default=False),
frontend_session_lifetime=dict(type='int', required=True),
frontend_session_lifetime_limited=dict(type='bool', required=False, default=True, choices=[True, False]),
frontend_session_lifetime_limited=dict(type='bool', required=False, default=True),
frontend_session_lifetime_scope=dict(type='str', required=False, default="hours", choices=['days', 'hours', 'minutes']),
frontend_session_timeout=dict(type='int', required=True),
frontend_session_timeout_enabled=dict(type='bool', required=False, default=True, choices=[True, False]),
frontend_session_timeout_enabled=dict(type='bool', required=False, default=True),
frontend_session_timeout_scope=dict(type='str', required=False, default="minutes", choices=['days', 'hours', 'minutes']),
logout_delegation_urls=dict(type='list', elements='str', required=False, default=[]),
logout_mode=dict(type='str', required=False, default="None", choices=['None', 'Delegation']),
redirect_to_requested_url=dict(type='bool', required=False, default=False, choices=[True, False])
redirect_to_requested_url=dict(type='bool', required=False, default=False)
)
)
try:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/zfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
name: rpool/myfs
state: present
extra_zfs_properties:
setuid: off
setuid: 'off'
- name: Create a new volume called myvol in pool rpool.
community.general.zfs:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/aix_devices/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
device: en1
attributes:
mtu: 900
arp: off
arp: 'off'
state: present

- name: Configure IP, netmask and set en1 up.
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/alternatives/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

- include_tasks: tests.yml
with_nested:
- [ True, False ] # with_link
- [ True, False ] # with_alternatives
- [ true, false ] # with_link
- [ true, false ] # with_alternatives
- [ 'auto', 'manual' ] # mode
loop_control:
loop_var: test_conf
Expand All @@ -34,7 +34,7 @@
- include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4
vars:
with_alternatives: True
with_alternatives: true
mode: auto

- block:
Expand All @@ -44,7 +44,7 @@
- include_tasks: tests_set_priority.yml
with_sequence: start=3 end=4
vars:
with_alternatives: False
with_alternatives: false
mode: auto

# Test that path is checked: alternatives must fail when path is nonexistent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
name: dummy
path: '/non/existent/path/there'
link: '/usr/bin/dummy'
ignore_errors: True
ignore_errors: true
register: alternative

- name: Check previous task failed
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/targets/alternatives/tasks/subcommands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
- name: Execute the current dummysubcmd command
command: dummysubcmd
register: cmd
ignore_errors: True
ignore_errors: true

- name: Ensure that the subcommand is gone
assert:
Expand Down Expand Up @@ -166,7 +166,7 @@
- name: Execute the current dummysubcmd command
command: dummysubcmd
register: cmd
ignore_errors: True
ignore_errors: true

- name: Ensure that the subcommand is gone
assert:
Expand Down
14 changes: 7 additions & 7 deletions tests/integration/targets/apache2_module/tasks/actualtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
community.general.apache2_module:
name: autoindex
state: absent
force: True
force: true

- name: reenable autoindex
community.general.apache2_module:
Expand All @@ -93,7 +93,7 @@
community.general.apache2_module:
name: dump_io
state: present
ignore_errors: True
ignore_errors: true
register: enable_dumpio_wrong

- name: disable dump_io
Expand Down Expand Up @@ -132,7 +132,7 @@
community.general.apache2_module:
name: "{{ item }}"
state: absent
ignore_configcheck: True
ignore_configcheck: true
with_items:
- mpm_worker
- mpm_event
Expand All @@ -142,7 +142,7 @@
community.general.apache2_module:
name: mpm_event
state: present
ignore_configcheck: True
ignore_configcheck: true
register: enabledmpmevent

- name: ensure changed mpm_event
Expand All @@ -154,7 +154,7 @@
community.general.apache2_module:
name: "{{ item.name }}"
state: "{{ item.state }}"
ignore_configcheck: True
ignore_configcheck: true
with_items:
- name: mpm_event
state: absent
Expand Down Expand Up @@ -193,7 +193,7 @@
community.general.apache2_module:
name: "{{item}}"
state: absent
ignore_configcheck: True
ignore_configcheck: true
with_items:
- mpm_worker
- mpm_event
Expand All @@ -203,5 +203,5 @@
community.general.apache2_module:
name: mpm_event
state: present
ignore_configcheck: True
ignore_configcheck: true
register: enabledmpmevent
2 changes: 1 addition & 1 deletion tests/integration/targets/archive/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
# Newer versions of brew want to compile a package which takes a long time. Do not upgrade homebrew until a
# proper solution can be found
environment:
HOMEBREW_NO_AUTO_UPDATE: True
HOMEBREW_NO_AUTO_UPDATE: "True"
when:
- ansible_python_version.split('.')[0] == '2'
- ansible_os_family == 'Darwin'
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/targets/consul/tasks/consul_session.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

- name: search created session
set_fact:
test_session_found: True
test_session_found: true
loop: "{{ result['sessions'] }}"
when: "item.get('ID') == session_id and item.get('Name') == 'testsession'"

Expand All @@ -69,7 +69,7 @@
state: info
name: test
register: result
ignore_errors: True
ignore_errors: true

- assert:
that:
Expand All @@ -81,7 +81,7 @@
id: '{{ session_id }}'
scheme: non_existent
register: result
ignore_errors: True
ignore_errors: true

- assert:
that:
Expand All @@ -94,7 +94,7 @@
port: 8501
scheme: https
register: result
ignore_errors: True
ignore_errors: true

- name: previous task should fail since certificate is not known
assert:
Expand All @@ -108,7 +108,7 @@
id: '{{ session_id }}'
port: 8501
scheme: https
validate_certs: False
validate_certs: false
register: result

- name: previous task should succeed since certificate isn't checked
Expand Down
26 changes: 13 additions & 13 deletions tests/integration/targets/filesystem/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
tested_filesystems:
# key: fstype
# fssize: size (Mo)
# grow: True if resizefs is supported
# grow: true if resizefs is supported
# Other minimal sizes:
# - XFS: 20Mo
# - Btrfs: 150Mo (50Mo when "--metadata single" is used and 100Mb when on newer Fedora versions)
Expand All @@ -15,19 +15,19 @@ tested_filesystems:
# - 1.7.0 requires at least 30Mo
# - 1.10.0 requires at least 38Mo
# - resizefs asserts when initial fs is smaller than 60Mo and seems to require 1.10.0
ext4: {fssize: 10, grow: True}
ext4dev: {fssize: 10, grow: True}
ext3: {fssize: 10, grow: True}
ext2: {fssize: 10, grow: True}
xfs: {fssize: 300, grow: False} # grow requires a mounted filesystem
btrfs: {fssize: 150, grow: False} # grow requires a mounted filesystem
reiserfs: {fssize: 33, grow: False} # grow not implemented
vfat: {fssize: 20, grow: True}
ocfs2: {fssize: '{{ ocfs2_fssize }}', grow: False} # grow not implemented
ext4: {fssize: 10, grow: true}
ext4dev: {fssize: 10, grow: true}
ext3: {fssize: 10, grow: true}
ext2: {fssize: 10, grow: true}
xfs: {fssize: 300, grow: false} # grow requires a mounted filesystem
btrfs: {fssize: 150, grow: false} # grow requires a mounted filesystem
reiserfs: {fssize: 33, grow: false} # grow not implemented
vfat: {fssize: 20, grow: true}
ocfs2: {fssize: '{{ ocfs2_fssize }}', grow: false} # grow not implemented
f2fs: {fssize: '{{ f2fs_fssize|default(60) }}', grow: 'f2fs_version is version("1.10.0", ">=")'}
lvm: {fssize: 20, grow: True}
swap: {fssize: 10, grow: False} # grow not implemented
ufs: {fssize: 10, grow: True}
lvm: {fssize: 20, grow: true}
swap: {fssize: 10, grow: false} # grow not implemented
ufs: {fssize: 10, grow: true}


get_uuid_any: "blkid -c /dev/null -o value -s UUID {{ dev }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
dev: '{{ dev }}'
fstype: '{{ fstype }}'
register: fs_result
ignore_errors: True
ignore_errors: true

- name: 'Get UUID of the filesystem'
ansible.builtin.shell:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/targets/filter_from_csv/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
debug:
var: "invalid_comma_separated | community.general.from_csv(strict=True)"
register: _invalid_csv_strict_true
ignore_errors: True
ignore_errors: true

- name: Test invalid csv input when strict=True is failed
assert:
Expand Down
Loading

0 comments on commit 47514e1

Please sign in to comment.