Commit 2091c236 authored by Leigh B Stoller's avatar Leigh B Stoller

For repo based profiles, send (email) the geni-lib python errors to the

user, so they can see what has failed. Makes it easier to debug when
there is a push hook on the repo.
parent fbce0e2c
......@@ -960,11 +960,16 @@ sub UpdateProfileFromRepo()
elsif (!$project->AccessCheck($this_user, TB_PROJECT_MAKEIMAGEID())) {
fatal("Not enough permission in this project");
}
if ($profile->WaitForLock(10)) {
if ($profile->WaitForLock(30)) {
print STDERR "Profile is busy, cannot lock it.\n";
exit(1);
}
$usenewgenilib = UseNewGenilib($project);
# For sending email
my $profile_name = $profile->name();
my $profile_pid = $profile->pid();
my $creator = User->Lookup($profile->creator_idx());
#
# We want to update the profile from its URL, and get back the
......@@ -974,6 +979,14 @@ sub UpdateProfileFromRepo()
if ($?) {
print STDERR $output;
$profile->Unlock();
$project->SendEmail($creator->email(),
"Failure to update profile from Git repository",
"Profile $profile_pid,$profile_name could not be pulled\n".
"from its git repository:\n\n" . $output . "\n\n" .
$profile->AdminURL() . "\n",
$project->Brand()->OpsEmailAddress(),
# Temporary.
"BCC: " . $project->Brand()->LogsEmailAddress());
fatal("Could not update repo from $repourl");
}
if ($verbose) {
......@@ -998,11 +1011,22 @@ sub UpdateProfileFromRepo()
print $fh $script;
$output = emutil::ExecQuiet("$RUNGENILIB $opts $filename");
if ($?) {
my $exit_status = $? >> 8;
print STDERR $output;
$profile->Unlock();
$project->SendEmail($creator->email(),
"Failure to update profile from Git repository",
"Profile $profile_pid,$profile_name could not be updated\n".
"from its git repository:\n\n" . $output . "\n\n" .
$profile->AdminURL() . "\n",
$project->Brand()->OpsEmailAddress(),
# Temporary.
"BCC: " . $project->Brand()->LogsEmailAddress());
print STDERR "UpdateProfileFromRepo: $RUNGENILIB failed\n";
# Pass along the exit value.
exit($? >> 8);
exit($exit_status);
}
$rspec = $output;
}
......@@ -1024,9 +1048,6 @@ sub UpdateProfileFromRepo()
exit(1);
}
}
my $profile_name = $profile->name();
my $profile_pid = $profile->pid();
my $creator = User->Lookup($profile->creator_idx());
$project->SendEmail($creator->email(),
"Profile updated from Git repository",
"Profile $profile_pid,$profile_name has been updated ".
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment