removed no_stored_credentials flag and always use passed credentials from arguments if possible

This commit is contained in:
iLLiCiTiT 2021-05-26 18:42:25 +02:00
parent 22811ccadd
commit b9e6f99a66
2 changed files with 7 additions and 8 deletions

View file

@ -60,8 +60,6 @@ def tray(debug=False):
help="Ftrack api user")
@click.option("--ftrack-api-key", envvar="FTRACK_API_KEY",
help="Ftrack api key")
@click.option("--no-stored-credentials", is_flag=True,
help="don't use stored credentials")
@click.option("--legacy", is_flag=True,
help="run event server without mongo storing")
@click.option("--clockify-api-key", envvar="CLOCKIFY_API_KEY",
@ -72,7 +70,6 @@ def eventserver(debug,
ftrack_url,
ftrack_user,
ftrack_api_key,
no_stored_credentials,
legacy,
clockify_api_key,
clockify_workspace):
@ -88,7 +85,6 @@ def eventserver(debug,
ftrack_url,
ftrack_user,
ftrack_api_key,
no_stored_credentials,
legacy,
clockify_api_key,
clockify_workspace

View file

@ -422,15 +422,18 @@ def run_event_server(
ftrack_url,
ftrack_user,
ftrack_api_key,
no_stored_credentials,
legacy,
clockify_api_key,
clockify_workspace
):
if not no_stored_credentials:
if not ftrack_user or not ftrack_api_key:
print((
"Ftrack user/api key were not passed."
" Trying to use credentials from user keyring."
))
cred = credentials.get_credentials(ftrack_url)
ftrack_user = cred.get('username')
ftrack_api_key = cred.get('api_key')
ftrack_user = cred.get("username")
ftrack_api_key = cred.get("api_key")
if clockify_workspace and clockify_api_key:
os.environ["CLOCKIFY_WORKSPACE"] = clockify_workspace