Cray-HPE / sat

System Admin Toolkit
https://cray-hpe.github.io/docs-sat/
MIT License
4 stars 5 forks source link

CRAYSAT-1392: Graceful handle of user token expiry #252

Closed shivaprasad-metimath closed 2 months ago

shivaprasad-metimath commented 2 months ago

Summary and Scope

During the sat status execution if the user token is expired, there is a traceback which comes as the output. Hence graceful handling of the token expiry is added to inform the user.

Issues and Related PRs

List and characterize relationship to Jira/Github issues and other pull requests. Be sure to list dependencies.

Testing

List the environments in which these changes were tested.

Tested on:

Test description:

Manually the expiry date was updated in ~/.config/sat/tokens/api_gw_service_nmn_local.vers.json to replicate the issue. And then the sat commands such as sat status, hwinv, hwmatch were executed to validate the changes

Risks and Mitigations

Low risk

Pull Request Checklist

shivaprasad-metimath commented 2 months ago

Manually the expire date was changed in the ~/.config/sat/tokens/api_gw_service_nmn_local.vers.json to recreate the issue and then validated. testing output on rocket: https://gist.github.com/shivaprasad-metimath/d0f9a8d0df9458bc117e02fab7571166

shivaprasad-metimath commented 2 months ago

Testing output on rocket:

(d950e16dc37a) sat-container:/ # sat status ERROR: Invalid grant error: The token is not active or is invalid.Please re-authenticate using 'sat auth' to obtain a new token (d950e16dc37a) sat-container:/ # sat hwinv ERROR: Invalid grant error: The token is not active or is invalid.Please re-authenticate using 'sat auth' to obtain a new token (d950e16dc37a) sat-container:/ # sat hwmatch ERROR: Invalid grant error: The token is not active or is invalid.Please re-authenticate using 'sat auth' to obtain a new token (d950e16dc37a) sat-container:/ # sat firmware ERROR: Invalid grant error: The token is not active or is invalid.Please re-authenticate using 'sat auth' to obtain a new token (d950e16dc37a) sat-container:/ #