diff --git a/wfm/src/WFMSubAgent.cc b/wfm/src/WFMSubAgent.cc index 9fee5d719..4752f3e28 100644 --- a/wfm/src/WFMSubAgent.cc +++ b/wfm/src/WFMSubAgent.cc @@ -31,6 +31,13 @@ WFMSubAgent::WFMSubAgent (const string& name, int handle) my_comp (0), my_agent (0) { + // TODO when perl-bootloader die, remove whole system namespacing + // check if name is scr ( can be prepended by chroot like "chroot=/mnt:scr" ) + if (name.find("scr") == string::npos) + { + y2internal("WFMSubAgent support only scr component, but not '%s'.", name); + abort; + } } @@ -49,20 +56,28 @@ WFMSubAgent::start () if (!my_comp) { y2debug ("Creating SubAgent: %d %s", my_handle, my_name.c_str ()); - my_comp = Y2ComponentBroker::createServer (my_name.c_str ()); - - if (!my_comp) - { - ycp2error ("Can't create component '%s'", my_name.c_str ()); - } - else - { - if (my_comp->getSCRAgent () == NULL) - { - // the component does not have a SCR agent, better try to push over stdio - my_agent = new StdioSCRAgent (my_comp); + // different behavior in chroot and non-chroot as for chroot we need to + // handle specially system namespace via scr_remote + // TODO remove after perl-bootloader die, then else branch is enough + if (my_name.find("chroot") != string::npos) + { + Y2Component *scr_comp = Y2ComponentBroker::createServer (my_name.c_str ()); + my_comp = Y2ComponentBroker::createServer ((my_name+"_remote").c_str ()); + if (!scr_comp) + { + ycp2error ("Can't create component 'scr'"); + return false; } - } + // WFM subagent use specialized agent for remote and scr_remote as + // component + // see Y2WFMComponent::SCRSetDefault implementation for details + // how it works + my_agent = scr_comp->getSCRAgent(); + } + else + { + Y2Component *my_comp = Y2ComponentBroker::createServer (my_name.c_str ()); + } } return my_comp != 0;