Skip to content

Commit

Permalink
Agent spawner configurations should be accessible
Browse files Browse the repository at this point in the history
... as attributes.

Signed-off-by: Siteshwar Vashisht <[email protected]>
  • Loading branch information
siteshwar committed Mar 14, 2024
1 parent 337b16d commit bee7873
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion resalloc_agent_spawner/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ def get_config():
group.setdefault("cmd_terminate", "/bin/true")
group.setdefault("cmd_try_release", "/bin/false")
group.setdefault("tags", ["please-specify-some-tags"])
return config

# This dictionary is passed to redis APIs and other parts of code which
# expects configurations to be attributes rather than key/value pairs.
# This class works around this requirement.
# Thanks to https://stackoverflow.com/a/14620633
class AttrDict(dict):

Check warning

Code scanning / vcs-diff-lint

get_config.AttrDict: Missing class docstring Warning

get_config.AttrDict: Missing class docstring
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)

Check warning

Code scanning / vcs-diff-lint

get_config.AttrDict.init: Consider using Python 3 style super() without arguments Warning

get_config.AttrDict.__init__: Consider using Python 3 style super() without arguments
self.__dict__ = self

return AttrDict(config)


class CmdCallerMixin:
Expand Down

0 comments on commit bee7873

Please sign in to comment.