-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to SCR component to operate on different root
Before, the `scr` component was common agent server component. There is also scr server program located at `/usr/share/YaST2/servers/scr`, that allows to call scr as external program in chroot via ProgramCompnent. Now to remove the need for `chroot(2)`, scr component can be instantiated with target root, which is propagated to whole scr agent tree. It require API changes because common SCRAgent template doesn't fit there.
- Loading branch information
1 parent
da31966
commit 1943107
Showing
9 changed files
with
158 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef Y2CCSCR_H | ||
#define Y2CCSCR_H | ||
|
||
#include <y2/Y2ComponentCreator.h> | ||
#include <map> | ||
#include <string> | ||
|
||
#include "ScriptingAgent.h" | ||
#include "Y2SCRComponent.h" | ||
|
||
class Y2CCSCR : public Y2ComponentCreator | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor of a SCR component creator. | ||
*/ | ||
Y2CCSCR (); | ||
|
||
|
||
/** | ||
* Destructor of a SCR component creator. | ||
*/ | ||
~Y2CCSCR (); | ||
|
||
|
||
/** | ||
* Returns true since all agents are server components. | ||
*/ | ||
bool isServerCreator () const { return true; } | ||
|
||
/** | ||
* Creates a new @ref Y2Component if the name matches the one | ||
* provided in the constructor. | ||
*/ | ||
Y2Component* create (const char*) const; | ||
|
||
/** | ||
* Agent components do not provide any namespaces. | ||
*/ | ||
Y2Component* provideNamespace (const char*) { return NULL; } | ||
|
||
private: | ||
|
||
/* SCR instances, owned by this class, keyed by target root. | ||
* Target root must be valid absolute path like "/" or "/mnt".*/ | ||
mutable std::map<std::string, Y2SCRComponent*> scr_instances; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "Y2SCRComponent.h" | ||
#include "ScriptingAgent.h" | ||
|
||
|
||
Y2SCRComponent::Y2SCRComponent(const char *root) : | ||
Y2AgentComp<ScriptingAgent>("scr") | ||
{ | ||
agent = new ScriptingAgent(root); | ||
} | ||
|
||
Y2SCRComponent::~Y2SCRComponent() | ||
{ | ||
//agent is destructed in parent | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef Y2SCRCOMPONENT_H | ||
#define Y2SCRCOMPONENT_H | ||
|
||
#include <scr/Y2AgentComponent.h> | ||
#include "ScriptingAgent.h" | ||
|
||
class Y2SCRComponent : public Y2AgentComp<ScriptingAgent> | ||
{ | ||
public: | ||
Y2SCRComponent(const char* root); | ||
|
||
~Y2SCRComponent(); | ||
}; | ||
|
||
#endif |