Skip to content

Commit

Permalink
Add RHCloud.advisor_engine_config API (#1276)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpapaioa authored Feb 18, 2025
1 parent 7ef23c0 commit 75a58c5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nailgun/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -7669,7 +7669,7 @@ def __init__(self, server_config=None, **kwargs):

def path(self, which=None):
"""Extend ``nailgun.entity_mixins.Entity.path``."""
if which in ("enable_connector",):
if which in ("enable_connector", "advisor_engine_config"):
return f'{super().path(which="base")}/{which}'
return super().path(which)

Expand All @@ -7683,6 +7683,13 @@ def enable_connector(self, synchronous=True, timeout=None, **kwargs):
response = client.post(self.path('enable_connector'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)

def advisor_engine_config(self, synchronous=True, timeout=None, **kwargs):
"""Get advisor engine configuration information."""
kwargs = kwargs.copy()
kwargs.update(self._server_config.get_client_kwargs())
response = client.get(self.path('advisor_engine_config'), **kwargs)
return _handle_response(response, self._server_config, synchronous, timeout)


class RoleLDAPGroups(Entity):
"""A representation of a Role LDAP Groups entity."""
Expand Down
2 changes: 2 additions & 0 deletions tests/test_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ def test_noid_and_which(self):
(entities.ForemanTask, 'bulk_search'),
(entities.ForemanTask, 'summary'),
(entities.RHCloud, 'enable_connector'),
(entities.RHCloud, 'advisor_engine_config'),
(entities.Template, 'imports'),
(entities.Template, 'exports'),
):
Expand Down Expand Up @@ -2225,6 +2226,7 @@ def setUpClass(cls):
'post',
{'organization_id': 1, 'location_id': 2},
),
(entities.RHCloud(**plain_taxonomy).advisor_engine_config, 'get', {}),
(entities.Snapshot(**snapshot).revert, 'put', {}),
)

Expand Down

0 comments on commit 75a58c5

Please sign in to comment.