Skip to content

Commit

Permalink
Hotfix/401 unauthorized push keys (#916)
Browse files Browse the repository at this point in the history
* hotfix: handle 401 unauthorized Tapis error for pushing keys

* include UnauthorizedError for datafiles error handling
  • Loading branch information
rstijerina authored Dec 6, 2023
1 parent 877a639 commit 0127770
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const SystemsPushKeysModal = () => {
label="TACC Token"
required
disabled={submitting}
autocomplete="off"
autoComplete="off"
/>
</ModalBody>
<ModalFooter>
Expand Down
2 changes: 1 addition & 1 deletion client/src/redux/sagas/datafiles.sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export function* fetchFiles(action) {
},
});
// If listing returns 500, body should contain a system def for key pushing.
yield e.status === 500 &&
yield (e.status === 500 || e.status === 401) &&
put({
type: 'SET_SYSTEM',
payload: {
Expand Down
6 changes: 3 additions & 3 deletions server/portal/apps/datafiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.conf import settings
from django.http import JsonResponse, HttpResponseForbidden
from requests.exceptions import HTTPError
from tapipy.errors import InternalServerError
from tapipy.errors import InternalServerError, UnauthorizedError
from portal.views.base import BaseApiView
from portal.libs.agave.utils import service_account
from portal.apps.datafiles.handlers.tapis_handlers import (tapis_get_handler,
Expand Down Expand Up @@ -109,11 +109,11 @@ def get(self, request, operation=None, scheme=None, system=None, path='/'):

operation in NOTIFY_ACTIONS and \
notify(request.user.username, operation, 'success', {'response': response})
except InternalServerError as e:
except (InternalServerError, UnauthorizedError) as e:
error_status = e.response.status_code
error_json = e.response.json()
operation in NOTIFY_ACTIONS and notify(request.user.username, operation, 'error', {})
if error_status == 500:
if error_status == 500 or error_status == 401:
logger.info(e)
# In case of 500 determine cause
system = client.systems.getSystem(systemId=system)
Expand Down

0 comments on commit 0127770

Please sign in to comment.