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

Infra Join token Support for Bloxone Ansible v2 #47

Open
wants to merge 4 commits into
base: v2
Choose a base branch
from

Conversation

unasra
Copy link
Collaborator

@unasra unasra commented Dec 2, 2024

No description provided.

plugins/modules/infra_join_token.py Show resolved Hide resolved
if not resp.results:
resp.results = []

# If result is REVOKED, remove it from the list
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LIST call returns the "REVOKED" tokens too . This operation has been added to eliminate the revoked tokens

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI shows it as well, maybe we don't have to explicitly filter them out here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is implemented , assertion for idempotency would fail ( see comment below )

@unasra unasra changed the title UI join token Support for Bloxone Ansible v2 Infra Join token Support for Bloxone Ansible v2 Dec 2, 2024
- absent
default: present
description:
description: ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a lot of this description is empty.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Descriptions

""" # noqa: E501

EXAMPLES = r"""
- name: Create a UI Join token
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- name: Create a UI Join token
- name: Create a Join Token

same for the below examples as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed UI keyword from all instances except API Name

tags:
location: "my-location"

- name: Delete a UI Join token
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be better to explicitly state, we are revoking the token, instead of deleting.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

pass # Handled by BloxoneAnsibleModule


class UIJoinTokenModule(BloxoneAnsibleModule):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion to keep the names matching the module name JoinToken or InfraJoinToken

Suggested change
class UIJoinTokenModule(BloxoneAnsibleModule):
class JoinTokenModule(BloxoneAnsibleModule):

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if not resp.results:
resp.results = []

# If result is REVOKED, remove it from the list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The UI shows it as well, maybe we don't have to explicitly filter them out here.

Comment on lines 30 to 32
choices:
- present
- absent
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the choices here should be present and revoked as deletion is not allowed for join tokens.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

register: join_token
- assert:
that:
- join_token is not changed
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we dont filter out the revoked coin tokens , even though the join token would be revoked this , specific assertion would fail as find() function is bound to return the join token and the variable join_token would be updated accordingly .
So should this assertion be removed ?

Copy link
Collaborator

@mathewab mathewab Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The find function can return the same join token, which is fine. However a change should not be detected if the join token is found, and is already revoked. That logic needs to be checked.

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