This repository was archived by the owner on Jan 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +22
-15
lines changed Expand file tree Collapse file tree 3 files changed +22
-15
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,10 @@ def generate_parser(subparsers, action_target_dict):
7373 action_subparsers = cumulus_api_parser .add_subparsers (title = 'actions' , dest = 'action' , required = True )
7474 for action_k , target_v in action_target_dict .items ():
7575 action_parser = action_subparsers .add_parser (
76- action_k , help = f'{ action_k } action for the cumulus API' ,
77- usage = f'{ action_k } <target> ' ,
78- description = f'{ action_k } action for the cumulus API'
79- )
76+ action_k , help = f'{ action_k } action for the cumulus API' ,
77+ usage = f'{ action_k } <target> ' ,
78+ description = f'{ action_k } action for the cumulus API'
79+ )
8080 target_subparsers = action_parser .add_subparsers (title = 'target' , dest = 'target' , required = True )
8181 for target_k , argument_v in target_v .items ():
8282 plural = ''
Original file line number Diff line number Diff line change @@ -31,15 +31,21 @@ def get_hash_token_file():
3131 @classmethod
3232 def get_cumulus_api_instance (cls ):
3333 """ Get Cumulus instance with cached token"""
34- get_hashed_file_name = cls .get_hash_token_file ()
35- token : str
36- tempfile = f'{ mkdtemp ()} /{ get_hashed_file_name } '
37- if not os .path .isfile (tempfile ):
38- with open (tempfile , 'w' , encoding = 'utf-8' ) as _file :
39- cml = CumulusApi ()
40- _file .write (cml .TOKEN )
34+ if 'PRIVATE_API_LAMBDA_ARN' in os .environ :
35+ print ('getting non-token instance' )
36+ cml = CumulusApi ()
37+ pass
4138 else :
42- with open (tempfile , 'r' , encoding = 'utf-8' ) as _file :
43- token = _file .readline ()
44- cml = CumulusApi (token = token )
39+ print ('getting token instance' )
40+ get_hashed_file_name = cls .get_hash_token_file ()
41+ token : str
42+ tempfile = f'{ mkdtemp ()} /{ get_hashed_file_name } '
43+ if not os .path .isfile (tempfile ):
44+ with open (tempfile , 'w' , encoding = 'utf-8' ) as _file :
45+ cml = CumulusApi ()
46+ _file .write (cml .TOKEN )
47+ else :
48+ with open (tempfile , 'r' , encoding = 'utf-8' ) as _file :
49+ token = _file .readline ()
50+ cml = CumulusApi (token = token )
4551 return cml
Original file line number Diff line number Diff line change 1- cumulus-api @ https://github.com/ghrcdaac/cumulus-api/archive/refs/tags/v2.0.0.zip
1+
2+ cumulus-api @ https://github.com/ghrcdaac/cumulus-api/archive/refs/tags/v2.2.0.zip
23boto3 == 1.24.28
You can’t perform that action at this time.
0 commit comments