mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Fixing oauth token login and making module respect token over username/password
This commit is contained in:
parent
a2eab45d61
commit
3abd77c4c0
@ -31,9 +31,12 @@ class TowerAWXKitModule(TowerModule):
|
||||
|
||||
def authenticate(self):
|
||||
try:
|
||||
self.connection.login(username=self.username, password=self.password, token=self.oauth_token)
|
||||
# If we have neither of these, then we can try un-authenticated access
|
||||
self.authenticated = True
|
||||
if self.oauth_token:
|
||||
self.connection.login(None, None, token=self.oauth_token, auth_type='Bearer')
|
||||
self.authenticated = True
|
||||
elif self.username:
|
||||
self.connection.login(username=self.username, password=self.password)
|
||||
self.authenticated = True
|
||||
except Exception:
|
||||
self.exit_json("Failed to authenticate")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user