-
Notifications
You must be signed in to change notification settings - Fork 4
ConfigObjectInterface
When your engine factory or persistor factory objects are called to create engine or persistor objects, one of these object references is passed as a parameter. The object will always point to the specific section of the configuration file your particular component needs.
In general, any value in the configuration you receive that does not begin with an underscore character is available for you to use and specify the configuration of your component. The following methods are available for your use in retrieving the configuration data.
def get(self, path, defaultval=None):
Returns a configuration property in its "native" type (such as string or integer).
Parameters:
-
path
(type:str
) - The name of the configuration value to be returned. -
defaultval
(type:object
, optional) - A value returned if the given value is not found in the configuration. If this is not specified, the default isNone
.
Returns:
(type: object
) The configuration value, either as specified in the configuration file, or defaulted if it did not exist.
def string(self, path):
Returns a configuration property as a string, raising an exception if it isn't specified.
Parameters:
-
path
(type:str
) - The name of the configuration value to be returned.
Returns:
(type: str
) The configuration value, either specified in the configuration file.
Raises:
-
ConfigError
- If the value is not found, or is not a string type.
def string_default(self, path, defaultval=None):
Returns a configuration property as a string, defaulting it if it isn't specified.
Parameters:
-
path
(type:str
) - The name of the configuration value to be returned. -
defaultval
(type:str
, optional) - A value returned if the given value is not found in the configuration. If this is not specified, the default isNone
.
Returns:
(type: str
) The configuration value, either as specified in the configuration file, or defaulted if it did not exist.
Copyright © 2020 VMware Inc., All Rights Reserved.
Information here is current as of Carbon Black Cloud Binary Toolkit 1.0.0