Interface that configuration file parser classes have to implement.
More...
#include <DobbyConfig.h>
|
virtual bool | isValid () const =0 |
| Getters used for plugins.
|
|
virtual uid_t | userId () const =0 |
|
virtual gid_t | groupId () const =0 |
|
virtual IDobbyIPCUtils::BusType | systemDbus () const =0 |
|
virtual IDobbyIPCUtils::BusType | sessionDbus () const =0 |
|
virtual IDobbyIPCUtils::BusType | debugDbus () const =0 |
|
virtual bool | consoleDisabled () const =0 |
|
virtual ssize_t | consoleLimit () const =0 |
|
virtual const std::string & | consolePath () const =0 |
|
virtual bool | restartOnCrash () const =0 |
|
virtual const std::string & | rootfsPath () const =0 |
|
virtual std::shared_ptr< rt_dobby_schema > | config () const =0 |
|
virtual const std::map< std::string, Json::Value > & | rdkPlugins () const =0 |
|
bool | addMount (const std::string &source, const std::string &target, const std::string &fsType, unsigned long mountFlags, const std::list< std::string > &mountOptions) |
| Public api to allow for adding additional mounts. More...
|
|
bool | addEnvironmentVar (const std::string &envVar) |
| Public api to allow for adding additional env variables. More...
|
|
bool | changeProcessArgs (const std::string &command) |
|
bool | addWesterosMount (const std::string &socketPath) |
|
bool | writeConfigJson (const std::string &filePath) const |
| Writes bundle config string to a file. More...
|
|
const std::string | configJson () const |
| Get OCI bundle config json as string. More...
|
|
void | printCommand () const |
|
bool | enableSTrace (const std::string &logsDir) |
| Enables strace for the container. More...
|
|
void | setApparmorProfile (const std::string &profileName) |
| Set apparmor profile in config. More...
|
|
void | setPidsLimit (int limit) |
| Set cgroup pids limit. More...
|
|
|
bool | writeConfigJsonImpl (const std::string &filePath) const |
|
bool | updateBundleConfig (const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath) |
| Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLauncher to work with rdkPlugins. More...
|
|
bool | setHostnameToContainerId (const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath) |
| Sets the container hostname to the container ID. More...
|
|
bool | convertToCompliant (const ContainerId &id, std::shared_ptr< rt_dobby_schema > cfg, const std::string &bundlePath) |
| Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLauncher to work with rdkPlugins. More...
|
|
bool | isApparmorProfileLoaded (const char *profile) const |
| Check if apparmor profile is loaded. More...
|
|
|
static std::list< DevNode > | scanDevNodes (const std::list< std::string > &devNodes) |
| Takes a list of glob patterns corresponding to dev node paths and returns a list of structs with their details. More...
|
|
Interface that configuration file parser classes have to implement.
◆ addEnvironmentVar()
bool DobbyConfig::addEnvironmentVar |
( |
const std::string & |
envVar | ) |
|
Public api to allow for adding additional env variables.
This can only obviously be called before the config file is persisted to disk.
- Parameters
-
[in] | envVar | The environment variable to set |
- Returns
- true if the env var was added, otherwise false.
◆ addMount()
bool DobbyConfig::addMount |
( |
const std::string & |
source, |
|
|
const std::string & |
destination, |
|
|
const std::string & |
type, |
|
|
unsigned long |
mountFlags, |
|
|
const std::list< std::string > & |
mountOptions |
|
) |
| |
Public api to allow for adding additional mounts.
This can only obviously be called before the config file is persisted to disk.
- Parameters
-
[in] | source | The mount source |
[in] | destination | The mount destination |
[in] | type | The file system type of the mount |
[in] | mountFlags | The mount flags |
[in] | mountOptions | The mount options (mount(2) data parameter) |
- Returns
- true if the mount point was added, otherwise false.
◆ addPluginLauncherHooks()
void DobbyConfig::addPluginLauncherHooks |
( |
std::shared_ptr< rt_dobby_schema > |
cfg, |
|
|
const std::string & |
bundlePath |
|
) |
| |
|
private |
Adds OCI hooks to the config.
- Parameters
-
[in] | cfg | libocispec config structure instance |
[in] | bundlePath | path to the container bundle |
- Returns
- true if hooks added successfully, false if not
◆ addWesterosMount()
bool DobbyConfig::addWesterosMount |
( |
const std::string & |
socketPath | ) |
|
Adds a mount into the container for a westeros socket with the correct permissions at /tmp/westeros
Sets WAYLAND_DISPLAY and XDG_RUNTIME_DIR environment variables to ensure container actually uses the display
- Parameters
-
[in] | socketPath | Path to westeros socket on host |
◆ changeProcessArgs()
bool DobbyConfig::changeProcessArgs |
( |
const std::string & |
command | ) |
|
Changes the startup command for the container to a custom command.
Will automatically add DobbyInit to run the process to ensure sub-reaping is handled properly
- Parameters
-
[in] | command | The command to run (including arguments/params) |
◆ configJson()
const std::string DobbyConfig::configJson |
( |
| ) |
const |
Get OCI bundle config json as string.
- Returns
- OCI config json
◆ convertToCompliant()
bool DobbyConfig::convertToCompliant |
( |
const ContainerId & |
id, |
|
|
std::shared_ptr< rt_dobby_schema > |
cfg, |
|
|
const std::string & |
bundlePath |
|
) |
| |
|
protected |
Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLauncher to work with rdkPlugins.
- Parameters
-
[in] | id | container identifier |
[in] | cfg | libocispec config structure instance |
[in] | bundlePath | path to the container bundle |
◆ enableSTrace()
bool DobbyConfig::enableSTrace |
( |
const std::string & |
logsDir | ) |
|
Enables strace for the container.
- Parameters
-
[in] | logsDir | Directory to which strace logs will be written |
- Returns
- true if strace was sucessfully enabled for the container, otherwise false.
◆ findPluginLauncherHookEntry()
bool DobbyConfig::findPluginLauncherHookEntry |
( |
rt_defs_hook ** |
hook, |
|
|
int |
len |
|
) |
| |
|
private |
Checks a hook for Dobby plugin launcher entries.
- Parameters
-
[in] | hook | pointer to a hook in the bundle config |
[in] | len | number of entries in the hook |
- Returns
- true if unexpected Dobby plugin launcher entry found, false if not
◆ isApparmorProfileLoaded()
bool DobbyConfig::isApparmorProfileLoaded |
( |
const char * |
profile | ) |
const |
|
protected |
Check if apparmor profile is loaded.
- Parameters
-
[in] | profile | The name of apparmor profile. |
- Returns
- true if the apparmor profile was loaded in kernel space, otherwise false.
◆ printCommand()
void DobbyConfig::printCommand |
( |
| ) |
const |
Prints startup command for the container.
◆ scanDevNodes()
std::list< DobbyConfig::DevNode > DobbyConfig::scanDevNodes |
( |
const std::list< std::string > & |
devNodes | ) |
|
|
staticprotected |
Takes a list of glob patterns corresponding to dev node paths and returns a list of structs with their details.
If the glob pattern doesn't match a device node then it is ignored, this is not an error.
- Parameters
-
[in] | devNodes | The list of dev nodes paths (or glob patterns). |
◆ setApparmorProfile()
void DobbyConfig::setApparmorProfile |
( |
const std::string & |
defaultProfileName | ) |
|
Set apparmor profile in config.
Checks if profile from config is loaded. If not uses default profile if it is loaded.
- Parameters
-
[in] | defaultProfileName | The name of the default apparmor profile. |
◆ setHostnameToContainerId()
bool DobbyConfig::setHostnameToContainerId |
( |
const ContainerId & |
id, |
|
|
std::shared_ptr< rt_dobby_schema > |
cfg, |
|
|
const std::string & |
bundlePath |
|
) |
| |
|
protected |
Sets the container hostname to the container ID.
- Parameters
-
[in] | id | container identifier |
[in] | cfg | libocispec config structure instance |
[in] | bundlePath | path to the container bundle |
◆ setPidsLimit()
void DobbyConfig::setPidsLimit |
( |
int |
limit | ) |
|
◆ setPluginHookEntry()
void DobbyConfig::setPluginHookEntry |
( |
rt_defs_hook * |
entry, |
|
|
const std::string & |
name, |
|
|
const std::string & |
configPath |
|
) |
| |
|
private |
Populates a hook entry structure with DobbyPluginLauncher data.
- Parameters
-
[in] | entry | pointer to hook entry to populate |
[in] | name | hook name |
[in] | configPath | path to the config file |
◆ updateBundleConfig()
bool DobbyConfig::updateBundleConfig |
( |
const ContainerId & |
id, |
|
|
std::shared_ptr< rt_dobby_schema > |
cfg, |
|
|
const std::string & |
bundlePath |
|
) |
| |
|
protected |
Convert the input config.json into an OCI compliant bundle config that adds support for DobbyPluginLauncher to work with rdkPlugins.
- Parameters
-
[in] | id | container identifier |
[in] | cfg | libocispec config structure instance |
[in] | bundlePath | path to the container bundle |
◆ writeConfigJson()
bool DobbyConfig::writeConfigJson |
( |
const std::string & |
filePath | ) |
const |
Writes bundle config string to a file.
- Parameters
-
[in] | filePath | The name and path to the file to write to. |
- Returns
- true if the file was written correctly, otherwise false.
The documentation for this class was generated from the following files:
- bundle/lib/include/DobbyConfig.h
- bundle/lib/source/DobbyConfig.cpp