Skip to content
This repository has been archived by the owner on Mar 13, 2022. It is now read-only.

Fix conditional checking an int against time.struct_time #85

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/kube_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def _load_azure_token(self, provider):
if 'access-token' not in provider['config']:
return
if 'expires-on' in provider['config']:
if int(provider['config']['expires-on']) < time.gmtime():
if time.gmtime(int(provider['config']['expires-on'])) < time.gmtime():
Copy link
Contributor

Choose a reason for hiding this comment

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

what about if int(provider['config']['expires-on'])) < time.time()

Copy link
Contributor

Choose a reason for hiding this comment

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

also could you add a test case for it?

Copy link
Author

Choose a reason for hiding this comment

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

@yliaog I'm happy to add a test case for the above change. But I'm struggling with reliably running tests locally on my laptop. I see the project uses tox which I'm not really familiar with, but it appears to me to be a wrapper for nosetests.

Any pointers or tips from you will be much appreciated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Tested on azure. working for me thanks

self._refresh_azure_token(provider['config'])
self.token = 'Bearer %s' % provider['config']['access-token']
return self.token
Expand Down