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

The deeply nested list structure used for defining role mappings is highly complex and can be difficult to maintain. Consider refactoring this into a more manageable format, such as using a flat structure with explicit dependencies or utilizing a class-based approach to define roles and dependencies. This would enhance readability, make the codebase easier to maintain, and reduce the risk of errors during modifications. #1102

Open
berendt opened this issue Oct 21, 2024 · 0 comments

Comments

@berendt
Copy link
Member

berendt commented Oct 21, 2024

          The deeply nested list structure used for defining role mappings is highly complex and can be difficult to maintain. Consider refactoring this into a more manageable format, such as using a flat structure with explicit dependencies or utilizing a class-based approach to define roles and dependencies. This would enhance readability, make the codebase easier to maintain, and reduce the risk of errors during modifications.

Suggested Refactoring:

# Example of a possible refactoring using a class-based approach

class Role:
    def __init__(self, name, dependencies=None):
        self.name = name
        self.dependencies = dependencies or []

# Define roles
roles = [
    Role('neutron', dependencies=[
        Role('wait-for-nova', dependencies=[
            Role('octavia')
        ])
    ]),
    Role('barbican'),
    Role('designate'),
    Role('ironic')
]

Originally posted by @codereviewbot-ai[bot] in #1101 (comment)

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

No branches or pull requests

1 participant