Skip to content

Commit

Permalink
Merge pull request #323 from rackerlabs/fix_dedault_token
Browse files Browse the repository at this point in the history
fix: Moving default token filename outside of class
  • Loading branch information
cardoe authored Sep 19, 2024
2 parents db849f9 + f45103e commit 40ba6ae
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions python/neutron-understack/neutron_understack/argo/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@
urllib3.disable_warnings()


class ArgoClient:
DEFAULT_TOKEN_FILENAME = "/run/secrets/kubernetes.io/serviceaccount/token"
DEFAULT_TOKEN_FILENAME = "/run/secrets/kubernetes.io/serviceaccount/token"


class ArgoClient:
def __init__(
self,
token: str = None,
token: str | None = None,
namespace="default",
api_url="https://argo-server.argo.svc.cluster.local:2746",
logger=None,
):
if token is None:
with open(DEFAULT_TOKEN_FILENAME) as token_file:
token = token_file.read()
self.token = token
self.namespace = namespace
self.api_url = api_url
self.headers = {"Authorization": f"Bearer {self.token}"}
self.logger = logger

if token is None:
with open(DEFAULT_TOKEN_FILENAME) as token_file:
token = token_file.read()

def submit(
self,
Expand Down

0 comments on commit 40ba6ae

Please sign in to comment.