Skip to content

Commit

Permalink
Add api call for retrieve_config
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubek committed Oct 7, 2024
1 parent 94884f6 commit 40aeb99
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions leapp/actors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,17 @@ def report_error(self, message, severity=ErrorSeverity.ERROR, details=None):
actor=self,
details=details)

def retrieve_config(self):
"""
Retrieve the configuration specific to the specified schema.
:param schema: Configuration schemas
:type schema: :py:class:`leapp.models.Model`
:return: Dictionary containing requested configuration.
:rtype: dict
"""
return retrieve_config(self.config_schema)


def _is_type(value_type):
def validate(actor, name, value):
Expand Down
2 changes: 1 addition & 1 deletion leapp/actors/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def retrieve_config(schema):
for field in schema:
configuration[field.section][field.name] = _ACTOR_CONFIG[field.section][field.name]

return configuration
return dict(configuration)

#
# The function after this needs some work to be ready. It isn't part of the
Expand Down
7 changes: 7 additions & 0 deletions leapp/libraries/stdlib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,10 @@ def get_actor_tool_path(name):
:rtype: str or None
"""
return current_actor().get_actor_tool_path(name)


def retrieve_config():
"""
Retrieve the configuration specific to the specified schema.
"""
return current_actor().retrieve_config()

0 comments on commit 40aeb99

Please sign in to comment.