Drop password requirement for sudo access during automated tests

This commit is contained in:
Jason Ertel
2021-01-06 20:39:44 -05:00
parent bbdb47703d
commit 948f900673
2 changed files with 8 additions and 0 deletions

View File

@@ -2200,6 +2200,13 @@ mark_version() {
echo "$SOVERSION" > /etc/soversion
}
update_sudoers_for_testing() {
if [ -n "$TESTING" ]; then
info "Ensuring $INSTALLUSERNAME has password-less sudo access for automated testing purposes."
sed -i "s/^$INSTALLUSERNAME ALL=(ALL) ALL/^$INSTALLUSERNAME ALL=(ALL) NOPASSWD:ALL/" /etc/sudoers
fi
}
update_sudoers() {
if ! grep -qE '^soremote\ ALL=\(ALL\)\ NOPASSWD:(\/usr\/bin\/salt\-key|\/opt\/so\/saltstack)' /etc/sudoers; then

View File

@@ -594,6 +594,7 @@ set_redirect >> $setup_log 2>&1
set_progress_str 10 'Updating sudoers file for soremote user'
update_sudoers >> $setup_log 2>&1
update_sudoers_for_testing >> $setup_log 2>&1
set_progress_str 11 'Generating manager global pillar'
#minio_generate_keys