Skip to content
Snippets Groups Projects
Commit c285662b authored by Eric Cano's avatar Eric Cano
Browse files

Improved handling of non-existing Agent in cta-objectstore-unfollow-agent.

parent a3894713
Branches
Tags
No related merge requests found
......@@ -46,6 +46,20 @@ int main(int argc, char ** argv) {
} catch (std::bad_cast &){}
std::cout /* << "Object store path: " << be->getParams()->toURL()
<< " agent */<< "name=" << argv[2] << std::endl;
if (!be->exists(argv[2])) {
// Agent does not exist: remove from registry.
cta::objectstore::RootEntry re (*be);
cta::objectstore::ScopedSharedLock rel(re);
re.fetch();
cta::objectstore::AgentRegister ar(re.getAgentRegisterAddress(), *be);
rel.release();
cta::objectstore::ScopedExclusiveLock arl(ar);
ar.fetch();
ar.removeAgent(argv[2]);
ar.commit();
std::cout << "De-listed a non-existing agent." << std::endl;
exit (EXIT_SUCCESS);
}
cta::objectstore::Agent ag(argv[2], *be);
cta::objectstore::ScopedExclusiveLock agl(ag);
try {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment