Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
adisunw committed Mar 4, 2024
1 parent 689f949 commit 3514198
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions gestalt/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ def __init__(
self.vault_client = hvac.Client(url=url, token=token, cert=cert, verify=verify)
self._secret_expiry_times: Dict[str, datetime] = dict()
self._secret_values: Dict[str, Union[str, int, float, bool, List[Any]]] = dict()
self._is_connected: bool = False
self._role: Optional[str] = role
self._jwt: Optional[str] = jwt

self.delay = delay
self.tries = tries

def connect(self) -> None:
try:
retry_call(
self.vault_client.is_authenticated,
Expand All @@ -63,10 +60,10 @@ def connect(self) -> None:
"Gestalt Error: Unable to connect to vault with the given configuration"
)

if self._role and self._jwt:
if role and jwt:
try:
hvac.api.auth_methods.Kubernetes(self.vault_client.adapter).login(
role=self._role, jwt=self._jwt
role=role, jwt=jwt
)
token = retry_call(
self.vault_client.auth.token.lookup_self,
Expand Down Expand Up @@ -102,7 +99,6 @@ def connect(self) -> None:
args=(self.kubes_token_queue,),
)
kubernetes_ttl_renew.start()
self._is_connected = True

def stop(self) -> None:
self._run_worker = False
Expand All @@ -122,8 +118,6 @@ def get(
Returns:
secret (str): secret
"""
if not self._is_connected:
self.connect()
# if the key has been read before and is not a TTL secret
if key in self._secret_values and key not in self._secret_expiry_times:
return self._secret_values[key]
Expand Down

0 comments on commit 3514198

Please sign in to comment.