Merge pull request #8038 from john-westcott-iv/check_token_pre_del

Adding check that we are authenticated and also have a token

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2020-08-30 17:54:13 +00:00 committed by GitHub
commit 730cabe597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -551,7 +551,7 @@ class TowerAPIModule(TowerModule):
return self.create_if_needed(existing_item, new_item, endpoint, on_create=on_create, item_type=item_type, associations=associations)
def logout(self):
if self.authenticated:
if self.authenticated and self.oauth_token_id:
# Attempt to delete our current token from /api/v2/tokens/
# Post to the tokens endpoint with baisc auth to try and get a token
api_token_url = (