Skip to content

Commit

Permalink
Update DecClass to use server_config kwarg consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
tpapaioa committed May 28, 2024
1 parent 765e030 commit 4e4e9d8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1811,10 +1811,15 @@ def api(self):

def inject_config(cls, server_config):
"""inject a nailgun server config into the init of nailgun entity classes"""
import functools

class DecClass(cls):
__init__ = functools.partialmethod(cls.__init__, server_config=server_config)
def __init__(self, **kwargs):
"""Initialize entity class with the injected server config as the default.
If a different server_config is explicitly passed in, then it will be used.
"""
super().__init__(
**{**kwargs, "server_config": kwargs.get("server_config", server_config)}
)

return DecClass

Expand Down

0 comments on commit 4e4e9d8

Please sign in to comment.