-
Notifications
You must be signed in to change notification settings - Fork 122
Add role_user_assignment and role_team_assignment modules #408
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: tompage1994@hotmail.co.uk <tpage@redhat.com>
for more information, see https://pre-commit.ci
I know that the testing for role_team_assignment is not going to work because it requires a team to exist and I'm not entirely sure how I'd get that. I'll also take the action following release of this code to add the functionality to infra.aap_configuration |
9d93264
to
fa6a201
Compare
Signed-off-by: tompage1994@hotmail.co.uk <tpage@redhat.com>
f308846
to
eb34333
Compare
Signed-off-by: tompage1994@hotmail.co.uk <tpage@redhat.com>
for more information, see https://pre-commit.ci
type: str | ||
extends_documentation_fragment: | ||
- ansible.eda.eda_controller.auths | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please sanitize the documentation section and change it to two-space tab everywhere?
type: str | ||
extends_documentation_fragment: | ||
- ansible.eda.eda_controller.auths | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment about using two-space tabs. Check above.
author: "Tom Page (@Tompage1994)" | ||
short_description: Gives a team permission to a resource or an organization. | ||
description: | ||
- Use this endpoint to give a team permission to a resource or an organization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to suggest staying within the standard description of other modules and starting with something like
This module allows the user to give...
object_id: | ||
description: | ||
- Primary key of the object this assignment applies to. | ||
required: False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required: False
is implied by default. It can be removed here and elsewhere.
|
||
EXAMPLES = """ | ||
- name: Give Administrators organization admin role for org 1 | ||
ansible.platform.role_team_assignment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this change is for the EDA collection, can you please change the example here to ansible.eda.role_team_assignment
?
def main() -> None: | ||
# Any additional arguments that are not fields of the item can be added here | ||
argument_spec = dict( | ||
team=dict(required=False, type="str"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required=False
is also implied. It can be removed.
role_definition = controller.get_exactly_one( | ||
"role_definitions", name=role_definition_str | ||
) | ||
team = controller.get_exactly_one("teams", name=team_param) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this under a try/except clause?
role_definition = controller.get_exactly_one( | ||
"role_definitions", name=role_definition_str | ||
) | ||
user = controller.get_exactly_one("users", name=user_param) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also put this under a try/except.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an intermediate tasks
directory. It should be included under role_team_assignment/tasks/main.yml
to be picked up by tox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing an intermediate tasks
directory. It should be included under role_user_assignment/tasks/main.yml
to be picked up by tox.
…t-driven-ansible into role_assignment_modules
ok, fixed as requested. I've now taken the testing as far as I can. It's failing because the team doesn't exist. Not sure how I would be able to seed in a team as this would need to make use of ansible.platform.team module. Any ideas how this could be progressed? |
Teams can be created in EDA through |
resolves #407
Adds the modules to control the relevant endpoints. More info in the issue.