API¶
Runner¶
Config¶
-
class
ansibleci.config.Config(load_defaults=True)[source]¶ Configuration class which can be used to work with configuration parameters.
The class is designed to work with getters and setters, so you can easily read / write config parameters by accessing the Config instance’s attributes. You can also add complete Python modules to the Config instance by calling the add_module() method.
By default all
ansibleci.defaultswill be loaded, however you can overwrite that in the constructor.
Logger¶
-
class
ansibleci.logger.Logger(config)[source]¶ Logger class which is used to print log messages to stdout and stderr.
-
failed(message)[source]¶ Logs as whole test result as FAILED.
This method should only be used by the Runner.
-
info(message)[source]¶ Logs an informational message to stdout.
This method should only be used by the Runner.
-
Helper¶
-
class
ansibleci.helper.Helper(config)[source]¶ Helper class which provides common used helper methods.
-
get_absolute_path(path)[source]¶ Returns the absolute path of the
pathargument.If
pathis already absolute, nothing changes. If thepathis relative, then the BASEDIR will be prepended.
-
get_item_identifier(item)[source]¶ Returns the identifier of a (task) item, which by default is the name param of the item. If no name param is defined then the method will return “unknown”.
@todo: Update this method to consider other params when name is not defined (e.g. “include”).
-
get_roles()[source]¶ Returns a key-value dict with a roles, while the key is the role name and the value is the absolute role path.
-
get_roles_paths()[source]¶ Returns all absolute paths to the roles/ directories, while considering the
BASEDIRandROLESconfig variables.
-
get_yaml_items(dir_path, param=None)[source]¶ Loops through the dir_path and parses all YAML files inside the directory.
If no param is defined, then all YAML items will be returned in a list. If a param is defined, then all items will be scanned for this param and a list of all those values will be returned.
-
Test¶
-
class
ansibleci.test.Test(runner)[source]¶ This is the abstract class for all tests, which means all concrete test classes must inherit from this class.
-
failed(message)[source]¶ Marks a (sub-)test as failed. This will change the result of the whole test to FAILED.
-
get_config()[source]¶ Returns the Runner’s Config instance, which can be used to access configuration params.
-