aboutsummaryrefslogtreecommitdiff
path: root/bbot/agent/agent.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'bbot/agent/agent.cxx')
-rw-r--r--bbot/agent/agent.cxx29
1 files changed, 23 insertions, 6 deletions
diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx
index 2378fc2..be3b706 100644
--- a/bbot/agent/agent.cxx
+++ b/bbot/agent/agent.cxx
@@ -211,6 +211,7 @@ bootstrap_machine (const dir_path& md,
{
m->suspend (false);
m->wait (false);
+ m->cleanup ();
info << "resuming after machine suspension";
}
catch (const failed&) {}
@@ -236,7 +237,10 @@ bootstrap_machine (const dir_path& md,
// Failed, exit code diagnostics has already been issued.
}
- error << "machine " << md << " exited unexpectedly";
+ diag_record dr (error);
+ dr << "machine " << md << " exited unexpectedly";
+ m->print_info (dr);
+
return false;
};
@@ -273,8 +277,11 @@ bootstrap_machine (const dir_path& md,
if (retry > ops.bootstrap_retries ())
return soft_fail ("bootstrap startup timeout");
- warn << "machine " << mm.name << " appears to have "
- << "mis-booted, retrying";
+ // Note: keeping the logs behind (no cleanup).
+
+ diag_record dr (warn);
+ dr << "machine " << mm.name << " mis-booted, retrying";
+ m->print_info (dr);
try {m->forcedown (false);} catch (const failed&) {}
continue;
@@ -322,6 +329,8 @@ bootstrap_machine (const dir_path& md,
return soft_fail ("bootstrap shutdown timeout");
l3 ([&]{trace << "completed shutdown in " << shutdown_to - to << "s";});
+
+ m->cleanup ();
}
// Parse the result manifest.
@@ -897,6 +906,7 @@ try
{
m->suspend (false);
m->wait (false);
+ m->cleanup ();
info << "resuming after machine suspension";
}
catch (const failed&) {}
@@ -916,7 +926,10 @@ try
{
}
- error << "machine " << xp << " exited unexpectedly";
+ diag_record dr (error);
+ dr << "machine " << xp << " exited unexpectedly";
+ m->print_info (dr);
+
return false;
};
@@ -945,8 +958,11 @@ try
if (retry > ops.build_retries ())
return soft_fail ("build startup timeout");
- warn << "machine " << mm.machine.name << " appears to have "
- << "mis-booted, retrying";
+ // Note: keeping the logs behind (no cleanup).
+
+ diag_record dr (warn);
+ dr << "machine " << mm.machine.name << " mis-booted, retrying";
+ m->print_info (dr);
try {m->forcedown (false);} catch (const failed&) {}
continue;
@@ -1010,6 +1026,7 @@ try
// lease instead of a new one.
//
try {m->forcedown (false);} catch (const failed&) {}
+ m->cleanup ();
}
}