Skip to content

Commit

Permalink
testing for missing sudo passwd
Browse files Browse the repository at this point in the history
  • Loading branch information
lilyeyes committed Sep 7, 2023
1 parent fd0a988 commit 40f822c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 13 additions & 0 deletions lib/qesapdeployment.pm
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,19 @@ sub qesap_ansible_log_find_timeout
return $timeout_match ? 1 : 0;
}

=head3 qesap_ansible_log_find_missing_sudo_password
Return the '"msg": "Missing sudo password"' error found in the Ansible log or not
=cut

sub qesap_ansible_log_find_missing_sudo_password
{
my ($file) = @_;
my $search_string = 'Missing sudo password';
my $timeout_match = script_output("grep \"$search_string\" $file || exit 0");
return $timeout_match ? 1 : 0;
}

=head3 qesap_get_inventory
Return the path of the generated inventory
Expand Down
6 changes: 4 additions & 2 deletions tests/sles4sap/qesapdeployment/deploy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ sub run {
if ($ret[0])
{
my $rec_timeout = qesap_ansible_log_find_timeout($ret[1]);
if ($rec_timeout) {
record_info('DETECTED ANSIBLE TIMEOUT ERROR');
my $rec_missing_sudo_password = qesap_ansible_log_find_timeout($ret[1]);
if ($rec_timeout || $rec_missing_sudo_password) {
record_info('DETECTED ANSIBLE TIMEOUT ERROR') if $rec_timeout;
record_info('DETECTED ANSIBLE MISSING SUDO PASSWORD ERROR') if $rec_missing_sudo_password;
$self->clean_up();
@ret = qesap_execute(cmd => 'terraform', verbose => 1, timeout => 1800);
die "'qesap.py terraform' return: $ret[0]" if ($ret[0]);
Expand Down

0 comments on commit 40f822c

Please sign in to comment.