Skip to content

Commit e132946

Browse files
committed
Adding backwards compatibility
1 parent b1cf6f8 commit e132946

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

stashcp.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,22 @@ def getToken():
114114
"""
115115
# Get the scitoken content
116116
scitoken_file = None
117+
118+
# Command line
117119
if token_location:
118120
scitoken_file = token_location
119-
121+
# Environ
120122
if 'TOKEN' in os.environ:
121123
scitoken_file = os.environ['TOKEN']
122124

125+
# Backwards compatibility for getting scitokens
126+
if not scitoken_file and "_CONDOR_CREDS" in os.environ:
127+
# Token wasn't specified on the command line, try the default scitokens.use
128+
if os.path.exists(os.path.join(os.environ["_CONDOR_CREDS"], "scitokens.use")):
129+
scitoken_file = os.path.join(os.environ["_CONDOR_CREDS"], "scitokens.use")
130+
elif os.path.exists(".condor_creds/scitokens.use"):
131+
scitoken_file = os.path.join(os.path.abspath(".condor_creds/scitokens.use"))
132+
123133
if not scitoken_file or not os.path.exists(scitoken_file):
124134
logging.info("Unable to find token file")
125135
return None

0 commit comments

Comments
 (0)