Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Add Token refresh to export/import CLI #637

Merged
merged 2 commits into from
Jun 5, 2024

Conversation

aufi
Copy link
Member

@aufi aufi commented Jun 4, 2024

On slow environments or large data, export/import/clean-all CLI commands might take more than token lifetime is (5 minutes), that failed the operation.

Adding automatic token refresh and doing necessary refactoring to make it possible.

On slow environments or large data, export/import/clean-all CLI commands
might take more than token lifetime is (5 minutes).

Adding automatic token refresh and doing necessary refactoring to make it possible.

Signed-off-by: Marek Aufart <maufart@redhat.com>
@aufi aufi requested review from mansam and dymurray June 4, 2024 14:25
hack/tool/tackle Outdated
def checkTokenLifetime(self):
if self.TokenRenewAfter < int(time.time()):
self.Token = getHubToken(self.Url, c['username'], c['password'], False)
self.TokenRenewAfter = int(time.time()) + 4*60 # 4 minutes to refresh token
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the token have this information? If an auth provider has a shorter refresh token, this will fail, I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. The supported go-based implementation also uses Refresh call instead of new Login (https://github.com/konveyor/tackle2-hub/blob/main/binding/client.go#L781).

For this semi/un-supported Python script, that is planned to be replaced with a golang-based tooling, this could be a quickfix IMO.

The time was moved to constant to allow easier adjustment in case of problems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick fix makes sense, was just a concern, if this is not going to live for much longer I am good :)

Signed-off-by: Marek Aufart <maufart@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants