Files
kayobe/dev/kayobe-control-host-become-sudo-checker
Will Szumski 2829bf89f7 CI: Test kayobe_control_host_become
This change adds support for the kayobe_control_host_become variable to
CI jobs. This variable will cause any uses of become on localhost to
fail. This allows us to test that the kayobe_control_host_become
configuration variable has successfully removed all uses of become.

I've enabled this on a subset of jobs to get good test coverage.

Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/949758
Change-Id: I6da98e055714f75112cf08ff8aa53dd84de2e425
2025-05-19 17:20:21 +01:00

23 lines
524 B
Bash
Executable File

#!/bin/bash
IFS='' read -r -d '' ERR_MSG <<"EOF"
This task tried to use become, but kayobe_control_host_become is set to false. Please change become: true, to become: "{{ kayobe_control_host_become | bool }}", e.g:
- name: Run a command
command: echo hi
become: true
Should be:
- name: Run a command
command: echo hi
become: "{{ kayobe_control_host_become | bool }}"
Hint: You may need to write any files to a user controlled directory.
ErrorCode: CONTROL_HOST_BECOME_VIOLATION
EOF
>&2 echo "$ERR_MSG"
exit 1