Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent spawner configurations should be accessible #154

Closed
wants to merge 1 commit into from

Conversation

siteshwar
Copy link
Contributor

... as attributes.

... as attributes.

Signed-off-by: Siteshwar Vashisht <[email protected]>
# 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
# Thanks to https://stackoverflow.com/a/14620633
class AttrDict(dict):
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
praiskup added a commit to praiskup/copr that referenced this pull request Mar 14, 2024
The check like:

    if hasattr(opts, "redis_port"):
        kwargs["port"] = opts.redis_port

Can not work with dict() objects.  The hasattr() actually doesn't work
this way.

See: praiskup/resalloc#154
@praiskup
Copy link
Owner

Very good catch, thank you!

I think we should do fedora-copr/copr#3186 instead, to make copr-common accept dictionary objects. OTOH, I don't see any potential problems if this patch is merged; at least if we are in hurry for the fix.

praiskup added a commit to fedora-copr/copr that referenced this pull request Mar 15, 2024
The check like:

    if hasattr(opts, "redis_port"):
        kwargs["port"] = opts.redis_port

Can not work with dict() objects.  The hasattr() actually doesn't work
this way.

See: praiskup/resalloc#154
praiskup added a commit that referenced this pull request Mar 15, 2024
@praiskup praiskup closed this in 60f30d1 Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants