-
Notifications
You must be signed in to change notification settings - Fork 170
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
Adding functionality to set same token value across cluster #10801
base: master
Are you sure you want to change the base?
Adding functionality to set same token value across cluster #10801
Conversation
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.
lgtm
9e0b435
9e0b435
to
fd7bce2
Compare
fd7bce2
to
b6e3da5
Compare
be44ef2
b6e3da5
to
be44ef2
Compare
be44ef2
to
6df1b1e
Compare
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shivamdurgbuns The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1 similar comment
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: shivamdurgbuns The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Couple things here:
- changed
set_vault_token
from a staticmethod to a standard method since we need an instance reference. - changed the name to
get_vault_token
and updated the docstring since we are returning the value
ocs_ci/utility/kms.py
Outdated
@staticmethod | ||
def set_vault_token(self): | ||
""" | ||
This is a static method that will set the token value. | ||
""" | ||
if self.vault_path_token is None: | ||
self.vault_path_token = self.generate_vault_token() | ||
return self.vault_path_token |
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.
@staticmethod | |
def set_vault_token(self): | |
""" | |
This is a static method that will set the token value. | |
""" | |
if self.vault_path_token is None: | |
self.vault_path_token = self.generate_vault_token() | |
return self.vault_path_token | |
def get_vault_token(self): | |
""" | |
Get the Vault token value. Generate it first if it does not already exist. | |
Returns: | |
str: Vault token | |
""" | |
if self.vault_path_token is None: | |
self.vault_path_token = self.generate_vault_token() | |
return self.vault_path_token |
ocs_ci/utility/kms.py
Outdated
@@ -578,7 +593,7 @@ def vault_create_policy(self, policy_name=None): | |||
raise VaultOperationError( | |||
f"Failed to create policy f{self.vault_policy_name}" | |||
) | |||
self.vault_path_token = self.generate_vault_token() | |||
self.vault_path_token = self.set_vault_token(self) |
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.
self.vault_path_token = self.set_vault_token(self) | |
self.vault_path_token = self.get_vault_token() |
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
… token value Signed-off-by: Shivam Durgbuns <sdurgbun@redhat.com>
6df1b1e
to
ac0e253
Compare
@@ -578,7 +594,7 @@ def vault_create_policy(self, policy_name=None): | |||
raise VaultOperationError( | |||
f"Failed to create policy f{self.vault_policy_name}" | |||
) | |||
self.vault_path_token = self.generate_vault_token() | |||
self.vault_path_token = self.get_vault_token(self) |
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.
You don't need to explicitly pass this to the function anymore.
self.vault_path_token = self.get_vault_token(self) | |
self.vault_path_token = self.get_vault_token() |
This is for Vault Configuration.
fixes: https://issues.redhat.com/browse/OCSQE-1636